/// <param name="fromEmail">發件人的郵箱</param> /// <param name="toEmail">收件人的郵箱 多個用 “,”分隔</param> /// <param name="ccEmail">抄送 多個用 “,”分隔</param> /// <para ...
/// <param name="fromEmail">發件人的郵箱</param>
/// <param name="toEmail">收件人的郵箱 多個用 “,”分隔</param>
/// <param name="ccEmail">抄送 多個用 “,”分隔</param>
/// <param name="bccEmail">密送 多個用 “,”分隔</param>
/// <param name="subject">郵件主題</param>
/// <param name="body">郵件正文</param>
/// <param name="smtpAddress">郵件發送伺服器</param>
/// <param name="account">郵件發送賬號</param>
/// <param name="pwd">郵件發送密碼</param>
/// <returns></returns>
public static bool SendMailBySMTP(string body)
{
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage("自己郵箱@yingu.com", "自己郵箱@yingu.com");
//mail.s
mail.SubjectEncoding = Encoding.UTF8;
mail.Subject = "債權數據匹配數據獲取異常";
mail.IsBodyHtml = true; //是否允許內容為 HTML 格式
mail.BodyEncoding = Encoding.UTF8;
mail.Body = body;
SmtpClient smtp = new SmtpClient("smtp.qiye.163.com");
smtp.Credentials = new NetworkCredential("自己郵箱@yingu.com", "郵箱密碼"); //SMTP 驗證
//smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
bool rr = true;
try
{
smtp.Send(mail);
}
catch (Exception ex)
{
rr = false;
}
mail.Attachments.Dispose(); //郵件發送完畢,釋放對附件的鎖定
return rr;
}