I'm building a windows forms app on vb .net, one of them send a HTML email. I can send the email and the html tags and css wont show which means the program "Knows" it is html and not just a string. BUT I'm only getting the chunks of text (on any p, h or a tag) as plane text with no format one after another.
I tried to use EASendmail from Nuget packages with the same result. I searched on google and here for the problem without any success.
Here is what I have
Dim message As New MailMessage()
Dim fromAdd As MailAddress = New MailAddress("my mail here")
With message
.[To].Add("somebody email here")
.Subject = "TEST"
.From = fromAdd
.Priority = MailPriority.Normal
.IsBodyHtml = True
.BodyEncoding = System.Text.Encoding.UTF8
.Body = " <!DocType HTML>....the rest of the html code with the css..."
end with
Dim smtpClient As New SmtpClient("smtp.live.com")
With smtpClient
.EnableSsl = True
.Port = 587
.UseDefaultCredentials = False
.Credentials = New System.Net.NetworkCredential("mymail@somewhere.com", "password")
.DeliveryMethod = SmtpDeliveryMethod.Network
.Send(message)
.Dispose()
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
now I expected a nice looking html email, which I saved as a html page and it shows just fine when opened in chrome. for some reason I only getting the text paragraphs on it as plane text without any formatting, any attachment is also ignored, the image files attached to the email but the mail just wont show them neither.