简体   繁体   中英

Cannot send text/plain as in multipart email

This is not working to send a text and html multipart email? However, the user sees no text/plain part in gmail?

Dim M As New Net.Mail.MailMessage("someemail@domain.net", Configuration.ConfigurationSettings.AppSettings("Emailvalidation"))
        M.To.Clear()
        M.To.Add(New Net.Mail.MailAddress(TargetEmail, TargetName))
        Select Case SA.Address.Province
            Case "BC"
                M.Bcc.Add(New Net.Mail.MailAddress("bobs email", "bob"))
        End Select
        M.Subject = Subject

        Dim AV2 = Net.Mail.AlternateView.CreateAlternateViewFromString(M2.Body, New Net.Mime.ContentType("text/html"))
        M.AlternateViews.Add(AV2)

        Dim PT As String = PlainTextTemplate
        Dim AV = Net.Mail.AlternateView.CreateAlternateViewFromString(PT, New Net.Mime.ContentType("text/plain"))
        M.AlternateViews.Add(AV)

We figured it out... The code actually works. Gmail users only need to toggle "Message text garbled?" to have gmail show the plain text version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM