public SmtpClientEx GetSmtpCient() { var smtpClient = new SmtpClientEx { Host = SmtpSettings.Network.Host, Port = SmtpSettings.Network.Port, EnableSsl = false }; // Set timeout to 5 minutes string smtpTimeout = ConfigurationManager.AppSettings["MailSettingsSmtpTimeout"]; if (!string.IsNullOrEmpty(smtpTimeout)) { smtpClient.Timeout = int.Parse(smtpTimeout); } smtpClient.UseDefaultCredentials = false; var credential = new NetworkCredential { UserName = SmtpSettings.Network.UserName, Password = SmtpSettings.Network.Password }; smtpClient.Credentials = credential; // Set the method that is called back when the send operation ends. smtpClient.SendCompleted += SendCompletedCallback; return(smtpClient); }
public LogHelper() { Smtp = JocysCom.ClassLibrary.Mail.SmtpClientEx.Current; }
public SmtpClientEx GetSmtpCient() { var smtpClient = new SmtpClientEx { Host = SmtpSettings.Network.Host, Port = SmtpSettings.Network.Port, EnableSsl = false }; // Set timeout to 5 minutes string smtpTimeout = ConfigurationManager.AppSettings["MailSettingsSmtpTimeout"]; if (!string.IsNullOrEmpty(smtpTimeout)) { smtpClient.Timeout = int.Parse(smtpTimeout); } smtpClient.UseDefaultCredentials = false; var credential = new NetworkCredential { UserName = SmtpSettings.Network.UserName, Password = SmtpSettings.Network.Password }; smtpClient.Credentials = credential; // Set the method that is called back when the send operation ends. smtpClient.SendCompleted += SendCompletedCallback; return smtpClient; }