I am writing a program that sends an email with attachments. I need to send it as HTML but I can not find any reference as to how to do this. My code follows:

[
Private Sub sendMail(ByRef Message)
Dim Attach As Attachment
Attach = New Attachment("c:\Project\Articles1\Article.txt")
'create the mail message
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress("xxx@cox.net")
mail.To.Add("xxx@cox.net")
'set the content
mail.Subject = "Article to be submitted."
mail.Body = Message
mail.Attachments.Add(Attach)
'send the message
Dim smtp As New SmtpClient("smtp.east.cox.net")
smtp.Port = 25
smtp.EnableSsl = True
smtp.Credentials = New System.Net.NetworkCredential("xxx", "xxx")
smtp.Send(mail)
End Sub
]

Any help will be appreciated.

Recommended Answers

All 2 Replies

Member Avatar for dusan_nion

Try

mail.IsBodyHtml=true

Thanks, worked great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.