private void SendMail(Email email) { _mailman.SmtpHost = @"exchange.santeecooper.com"; _mailman.SmtpUsername = "******"; _mailman.SmtpPassword = Encryption.Decrypt(_docConfig.EmailNotificationPassword, "s@1tValue", "Pas5pr@se"); _mailman.SmtpPort = int.Parse(_docConfig.SmtpPort); _mailman.StartTLS = bool.Parse(_docConfig.StartTls); _mailman.SmtpSsl = bool.Parse(_docConfig.Ssl); _mailman.AutoFix = bool.Parse(_docConfig.AutoFix); if (_mailman.SendEmail(email) != true) { throw new Exception(_mailman.LastErrorText); } if (_mailman.CloseSmtpConnection() != true) { throw new Exception(_mailman.LastErrorText); } }
private static bool SentMessage(string hostSMTP, int portSMTP, bool sslSMTP, string username, string password, Email Mail) { MailMan smtp = new MailMan(); if (!(smtp.UnlockComponent("MAIL-TEAMBEAN_4895F76A292K"))) return false; smtp.SmtpHost = hostSMTP; smtp.SmtpPort = portSMTP; smtp.SmtpUsername = username; smtp.SmtpPassword = password; Mail.Charset = "utf-8"; if (sslSMTP) smtp.PopSsl = true; //SSL support else smtp.PopSsl = false; //connect without SSL support if (smtp.SendEmail(Mail)) return true; else return false; }
public static bool smtpAuthentication(string hostSMTP, int portSMTP, string userName, string password) { MailMan smtpTest = new MailMan(); smtpTest.SmtpHost = hostSMTP; smtpTest.SmtpPort = portSMTP; smtpTest.SmtpUsername = userName; smtpTest.SmtpPassword = password; if (SSL) smtpTest.PopSsl = true; else smtpTest.PopSsl = false; Email mail = new Email(); mail.From = userName; mail.AddTo("", userName); mail.Subject = "Test mail"; mail.SetHtmlBody("<html><body><b><font color='red' size='+1'>Thư kiểm tra</font></b></html>"); if (smtpTest.SendEmail(mail)) return true; else return false; }
//Sent message local public static bool SentMessage(Email Mail) { MailMan smtp = new MailMan(); if (!(smtp.UnlockComponent("MAIL-TEAMBEAN_4895F76A292K"))) return false; if (!Connect.SetConfigInfo()) return false; if (UserName == null) { UserName = FrameworkParams.currentUser.username + "@" + Connect.domain; Password = FrameworkParams.currentUser.id + "_protocolvn"; } smtp.SmtpHost = HostSMTP; smtp.SmtpPort = PortSMTP; smtp.SmtpUsername = AccountLogin(UserName); smtp.SmtpPassword = Password; Mail.From = UserName; if (SSLSMTP) smtp.PopSsl = true; //SSL support else smtp.PopSsl = false; //connect without SSL support if (smtp.SendEmail(Mail)) return true; else return false; }