Example #1
0
 public void SendMail()
 {
     SimpleMail.SMTPClient smtp = new SimpleMail.SMTPClient();
     MailMessage mm = new MailMessage("*****@*****.**", "*****@*****.**");
     mm.Body = txtMore.Text;
     mm.Subject = ErrorBox.Text;
     mm.BodyEncoding = UTF8Encoding.UTF8;
     mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
     smtp.SendMail(mm);
 }
Example #2
0
 //--
 //-- this is the code that executes in the spawned thread
 //--
 private static void ThreadHandler()
 {
     SimpleMail.SMTPClient objMail = new SimpleMail.SMTPClient();
     SimpleMail.SMTPMailMessage objMailMessage = new SimpleMail.SMTPMailMessage();
     var _with3 = objMailMessage;
     _with3.To = GetConfigString("EmailTo", "");
     _with3.Subject = "Unhandled Exception notification - " + _strExceptionType;
     _with3.Body = _strException;
     if (_blnLogToScreenshot & _blnEmailIncludeScreenshot)
     {
         _with3.AttachmentPath = _strScreenshotFullPath;
     }
     try
     {
         // call SendMail method in SimpleMail class
         objMail.SendMail(objMailMessage);
         //_blnLogToEmailOK = true;
     }
     catch (Exception)
     {
         //_blnLogToEmailOK = false;
         //-- don't do anything; sometimes SMTP isn't available, which generates an exception
         //-- and an exception in the unhandled exception manager.. is bad news.
         //--MsgBox("exception email failed to send:" + Environment.Newline + Environment.Newline + e.Message)
     }
 }
        //--
        //-- this is the code that executes in the spawned thread
        //--
        private static void ThreadHandler()
        {
            SimpleMail.SMTPClient objMail = new SimpleMail.SMTPClient();
            //SimpleMail.SMTPMailMessage objMailMessage = new SimpleMail.SMTPMailMessage();
            //var _with3 = objMailMessage;
            //_with3.To = "*****@*****.**";
            //_with3.Subject = "Unhandled Exception notification - " + _strExceptionType;
            //_with3.Body = _strException;
            //if (_blnLogToScreenshot & _blnEmailIncludeScreenshot)
            //{
            //    _with3.AttachmentPath = _strScreenshotFullPath;
            //}
            //try
            //{
            //    objMail.SendMail(objMailMessage);
            //    _blnLogToEmailOK = true;
            //}
            //catch (Exception e)
            //{
            //    _blnLogToEmailOK = false;
            //    //-- don't do anything; sometimes SMTP isn't available, which generates an exception
            //    //-- and an exception in the unhandled exception manager.. is bad news.
            //    //--MsgBox("exception email failed to send:" + Environment.Newline + Environment.Newline + e.Message)
            //}

            MailMessage mm = new MailMessage("*****@*****.**", "*****@*****.**");
            mm.Body = _strException;
            mm.Subject = "Unhandled Exception notification - " + _strExceptionType;
            if (_blnLogToScreenshot & _blnEmailIncludeScreenshot)
            {
                mm.Attachments.Add(new Attachment(_strScreenshotFullPath));
            }
            mm.BodyEncoding = UTF8Encoding.UTF8;
            mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
            objMail.SendMail(mm);
        }
Example #4
0
 //--
 //-- this is the code that executes in the spawned thread
 //--
 private static void ThreadHandler()
 {
     SimpleMail.SMTPClient smtp = new SimpleMail.SMTPClient();
     SimpleMail.SMTPMailMessage mail = new SimpleMail.SMTPMailMessage();
     var _with5 = mail;
     _with5.To = AppSettings.GetString("UnhandledExceptionManager/EmailTo");
     if (_blnHaveException)
     {
         _with5.Subject = "Handled Exception notification - " + _strExceptionType;
     }
     else
     {
         _with5.Subject = "HandledExceptionManager notification";
     }
     _with5.Body = _strEmailBody;
     //-- try to send email, but we don't care if it succeeds (for now)
     try
     {
         smtp.SendMail(mail);
     }
     catch (Exception e)
     {
         Debug.WriteLine("** SMTP email failed to send!");
         Debug.WriteLine("** " + e.Message);
     }
 }