这是用例:
我正在制作一个可以通过电子邮件发送 HTML Newsletters 的应用程序。该应用程序还将通过电子邮件发送简报的纯文本版本作为备用视图。在我看来,当使用 system.net.mail 命名空间时,有两种方法可以解决这个问题。这两种方式的优缺点是什么,或者我还缺少另一种方式吗?谢谢你。
Dim m As New MailMessage
' One alternate view'
m.IsBodyHtml = True
m.Body = HTMLString
m.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(plaintextstring), Nothing, "text/plain")
' OR two alternate views without specifying the body '
m.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(plaintextstring), Nothing, "text/plain")
m.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(HTMLstring), Nothing, "text/html")