Exemple #1
0
        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);
        }
Exemple #2
0
 public LogHelper()
 {
     Smtp = JocysCom.ClassLibrary.Mail.SmtpClientEx.Current;
 }
Exemple #3
0
 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;
 }