/// <summary> /// 发送邮件 /// </summary> /// <param name="ex"></param> /// <param name="to"></param> private void SendMail(Exception ex, string[] to) { if (to == null || to.Length == 0) { throw new ArgumentException("请传入收件人地址信息参数!"); } string title = string.Format("【{2}】({3}) - 异常邮件由【{0}({1})】发出", DnsHelper.GetHostName(), DnsHelper.GetIPAddress(), GetAppTitle(ex), GetServiceTitle(ex)); SmtpMail.Instance.SendExceptionAsync(ex, title, to); }
/// <summary> /// 发送邮件 /// </summary> /// <param name="log"></param> /// <param name="to"></param> private void SendMail(string log, string[] to) { if (to == null || to.Length == 0) { throw new ArgumentException("请传入收件人地址信息参数!"); } var body = CoreHelper.GetSubString(log, 20, "..."); string title = string.Format("{2} - 普通邮件由【{0}({1})】发出", DnsHelper.GetHostName(), DnsHelper.GetIPAddress(), body); SmtpMail.Instance.SendAsync(title, log, to); }