现在的位置: 首页 > 综合 > 正文

使用MailMessage.AlternateViews时遇到的小问题

2013年04月28日 ⁄ 综合 ⁄ 共 453字 ⁄ 字号 评论关闭

这是微软MSDN公布的Fix,希望对碰到同样问题的朋友有所帮助:

This appears to be inaccurate. The AlternateView class does not have a
constructor that takes a string as the first argument and a media type
as the second. This throws an error when I try it, because it treats
the body variable as a file name and attempts to find said file.

Here's the fix:

AlternateView alternate = AlternateView.CreateAlternateViewFromString(body, null, MediaTypeNames.Text.Html);

Courtesy of Mike Pope's site:

http://www.mikepope.com/blog/AddComment.aspx?blogid=1264

抱歉!评论已关闭.