System.net.mail isbodyhtml = true vs two alternatives / drawbacks AlternateViews

Here is a usage example:

I am making an application that will send HTML email newsletters. The application will also send an electronic version of the newsletter as an alternative submission. As I see it, there are two ways to get around this using the system.net.mail namespace. What are the advantages / disadvantages of these two methods, or is there another way that I am missing? Thank.

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")
+3
source share
1 answer

No, these are two ways to do this, you can also set the following for alternative views, as there may be strange side effects for different clients, if not.

AlternativeObject.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
+1
source

Source: https://habr.com/ru/post/1782811/


All Articles