/// <summary> /// Send SMTP email /// </summary> public void SendSmtp(string exceptionReport, CompletedMethodDelegate setEmailCompletedState) { var smtpClient = new SmtpClient(_reportInfo.SmtpServer) { DeliveryMethod = SmtpDeliveryMethod.Network }; var mailMessage = CreateMailMessage(exceptionReport); smtpClient.SendCompleted += delegate { setEmailCompletedState.Invoke(true); }; smtpClient.SendAsync(mailMessage, null); }
/// <summary> /// Send SMTP email /// </summary> public void SendSmtp(string exceptionReport, CompletedMethodDelegate setEmailCompletedState) { var smtpClient = new SmtpClient(_reportInfo.SmtpServer) { DeliveryMethod = SmtpDeliveryMethod.Network }; smtpClient.EnableSsl = _reportInfo.SmtpEnableSSL; smtpClient.Timeout = _reportInfo.SmtpTimeOut; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = new System.Net.NetworkCredential(_reportInfo.SmtpUsername, _reportInfo.SmtpPassword); var mailMessage = CreateMailMessage(exceptionReport); smtpClient.SendCompleted += delegate { setEmailCompletedState.Invoke(true); }; smtpClient.SendAsync(mailMessage, null); }