static private void smtp_email2(string msg, string title) { try { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient(SMTP2); mail.From = new MailAddress(MAILFROM); mail.To.Add(MAILTO); if (title == null || title.Equals(string.Empty)) { mail.Subject = SUBJECT2; } else { mail.Subject = title; } mail.Body = msg; SmtpServer.Port = 25; //SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password"); //SmtpServer.EnableSsl = true; if (MAIL_ENABLE) { SmtpServer.Send(mail); } } catch (Exception ex) { //MessageBox.Show(ex.Message, System.Reflection.MethodBase.GetCurrentMethod().Name); ExDash.SetLastException(ex, System.Reflection.MethodBase.GetCurrentMethod()); } }
/*******************************************************************************************************************\ * * \*******************************************************************************************************************/ static public void Fail(Exception ex, System.Reflection.MethodBase mb) { //string msg = string.Format("Error ({0}.{1}) : {2} ", mb.ReflectedType.Name, mb.Name, ex.Message); string msg = ExDash.SetLastException(ex, mb); if (Environment.UserInteractive) { MessageBox.Show(msg, ex.Source); } //EventLog.WriteEntry(EVENTSOURCE + " UserInteractive", msg); send_email(msg, ex.Source); }
static public void Warning(string err, System.Reflection.MethodBase mb) { //string msg = string.Format("Warning ({0}.{1}) : {2} ", mb.ReflectedType.Name, mb.Name, err); string msg = ExDash.SetLastWarning(err, mb); if (!Environment.UserInteractive) { send_email(msg); } else { //MessageBox.Show(msg, TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); EventLog.WriteEntry(EVENTSOURCE + " UserInteractive", msg); if (MAIL_ENABLE) { send_email(msg); } } //Application.Exit(); }