samedi 9 mai 2015

MailMessage encoding & incorrectly in outlook

I am trying to send this message in HTML

Hello Ryan Fishman,

Please click http://ift.tt/1cCN8uH">here to register for asportsmanager.com.

Using this vb.net code

        Dim mm As New MailMessage


        mm.From = New MailAddress(ConfigObject.SendEmailSender)
        mm.To.Add(New MailAddress(ToAddress))
        mm.Subject = Subject
        mm.IsBodyHtml = IsBodyHTML
        mm.Body = Nothing

        Dim ABody As AlternateView = Net.Mail.AlternateView.CreateAlternateViewFromString(Body)
        ABody.TransferEncoding = Mime.TransferEncoding.SevenBit
        ABody.ContentType = New Mime.ContentType("text/html; charset=""utf-8""")
        mm.AlternateViews.Add(ABody)

        Dim smtpclient As New SmtpClient(ConfigObject.SendEmailServer)
        smtpclient.UseDefaultCredentials = False
        smtpclient.Credentials = New System.Net.NetworkCredential(ConfigObject.SendEmailUsername, ConfigObject.SendEmailPassword)
        smtpclient.Send(mm)

When I send this email to a gmail account, the message is displayed fine. For some reason when it is sent to a hotmail (outlook) email the link is displayed as

http://ift.tt/1KUzVZj

notice the %c2%ae should be &reg.

Please help.

Aucun commentaire:

Enregistrer un commentaire