public static void sendEmail(String filename)
{
String title = "Price-Tax Price Report";
string message = "hi all,\\n Please check the Attachments";
MailMessage mail = MSMail.Compose("发送的EMIAL号", "服务器", title, message, filename);
MSMail.Send(mail);
}public static MailMessage Compose(string To, string From, string Subject, string Content, string AttachmentFile)
{
MailMessage mail = new MailMessage();
mail.To = To;
mail.From = From;
mail.Subject = Subject;
mail.Body = Content;
if (AttachmentFile != null && File.Exists(AttachmentFile))
mail.Attachments.Add(new MailAttachment(AttachmentFile));
return mail;
}public static void Send(MailMessage mail) { string sMailServer = AppConfig.Settings["MSMail.Server"].Trim();
SmtpMail.SmtpServer = sMailServer;
//SmtpMail.SmtpServer = "172.20.15.95";
SmtpMail.Send(mail);
}文件存在而且不为空 一直会报错 说Invalid mail attachment 不明白 请高手帮忙 谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货