public static void Say(string s, Type type) { log4net.ILog _lclogger = log4net.LogManager.GetLogger(type); string inf = MyConvert.ZHLC(string.Format("{0}", s)); _lclogger.Info(inf); }
public static void Say(Exception E, string DesWord, Type type) { log4net.ILog _lclogger = log4net.LogManager.GetLogger(type); string errorMessage = MyConvert.ZHLC(string.Format("\n{0}", DesWord)); _lclogger.Error(errorMessage, E); }
public void SendOut() { mail.From = MailFrom; mail.Subject = MyConvert.ZH_TW(Subject); mail.Sender = MailFrom; mail.SubjectEncoding = Encoding.UTF8; mail.IsBodyHtml = true; mail.Body = MyConvert.ZH_TW(MailBodyText); mail.To.Add(MailTo); if (MailCC != null && MailCC.Length > 0) { mail.CC.Add(MailCC); } mail.BodyEncoding = Encoding.UTF8; mail.HeadersEncoding = Encoding.UTF8; mail.Headers.Add("SenderIPAddress", LocalInfo.GetLocalIp()); mail.Headers.Add("Sender", MyConvert.ZHLC("ERP自动化伺服器")); mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure | DeliveryNotificationOptions.Delay; mail.Priority = MailPriority.Normal; SmtpClient Sender = new SmtpClient("59.125.179.177"); //SmtpClient Sender = new SmtpClient("my.imedia.com.tw"); //SmtpClient Sender = new SmtpClient("192.168.10.110"); Sender.Timeout = 30 * 1000; Sender.DeliveryMethod = SmtpDeliveryMethod.Network; Sender.EnableSsl = false; Sender.Port = 25; Sender.UseDefaultCredentials = false; Sender.Credentials = new NetworkCredential("AutoMessage", "HWGV1z86"); try { Sender.Send(mail); } catch (Exception ex) { MyRecord.Say("再试一次"); MyRecord.Say(ex); try { Sender.Send(mail); } catch (Exception exx) { MyRecord.Say(exx); } } }
public static void Say(string s) { string inf = MyConvert.ZHLC(string.Format("{0}", s)); _logger.Info(inf); }
/// <summary> /// 说出错误 /// </summary> /// <param name="E"></param> /// <param name="DesWord"></param> public static void Say(Exception E, string DesWord) { string errorMessage = MyConvert.ZHLC(string.Format("\n{0}", DesWord)); _logger.Error(errorMessage, E); }