public void SendEmail(MailMessage mailMessage)
 {
     mailMessage.Subject = String.Format("UI Exception for {0} - {1}", Environment.UserName, _exceptionType);
     mailMessage.Body = _exceptionMessage;
     mailMessage.AttachmentPaths.Add(ScreenshotFullPath);
     mailMessage.AttachmentPaths.Add(_logFilePath);
     try
     {
         _mailClient.PrepareAndSend(mailMessage);
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch (Exception) { }
     // ReSharper restore EmptyGeneralCatchClause
 }
 private void ExceptionToEmail()
 {
     var mailMessage = new MailMessage
                           {
                               Subject = "Handled Exception notification - " + ExceptionType,
                               Body = EmailBody
                           };
     try
     {
         _mailClient.PrepareAndSend(mailMessage);
     }
     catch
     {
     }
 }
Beispiel #3
0
 public void PrepareAndSend(MailMessage mailMessage)
 {
     const int intRetryInterval = 333;
     try
     {
         _postalWorker.SendMail(mailMessage);
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch (Exception)
     // ReSharper restore EmptyGeneralCatchClause
     {
         _intRetries += 1;
         if (_intRetries > IntMaxRetries)
         {
             throw;
         }
         Thread.Sleep(intRetryInterval);
         PrepareAndSend(mailMessage);
     }
 }