MailMessage Message = new MailMessage();
Message.From = new MailAddress(FPMail, "SCMCC", System.Text.Encoding.Default);
//取收件人邮件地址
for (int i = 0; i < AdminMail.Length; i++)
{
Message.To.Add(AdminMail[i]);
}
Message.Subject = "导出错误";
Message.Body = "导出错误,详情请参见附件.";
//加附件
System.Net.Mail.Attachment AttachItem = new System.Net.Mail.Attachment(Attach, MediaTypeNames.Application.Octet);
ContentDisposition disposition = AttachItem.ContentDisposition;
disposition.CreationDate = System.IO.File.GetCreationTime(Attach);
disposition.ModificationDate = System.IO.File.GetLastWriteTime(Attach);
disposition.ReadDate = System.IO.File.GetLastAccessTime(Attach);
Message.Attachments.Add(AttachItem);
Message.Priority = MailPriority.High;
Message.BodyEncoding = System.Text.Encoding.Default;
SmtpClient client = new SmtpClient(FPMailServer);
client.Credentials = new NetworkCredential(FPMail.Substring(0, FPMail.IndexOf('@')), FPMailServerPsd);
client.Send(Message);