SmtpClient发送邮件:An invalid character was found in the mail header

by kevin 8. 十月 2015 14:19 >
.net 4.0的环境下使用SmtpClient发送邮件,带有附件。碰到这个恶心的Exception System.FormatException: An invalid character was found in the mail header: 查了两天,终于解决了,是.Net自身的bug,据说后续版本是有解决的(估计.net 4.5以后)。 这里贴出解决方案: public static Attachment CreateAttachment(Stream attachmentFile, string displayName, string contentType, string attachmentFilePath) { var currentCulture = Thread.CurrentThread.Curr... [更多...]