コード例 #1
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)
            }
        }
コード例 #2
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);
            }
        }