I am trying to send an email message in HTML Format. I have a richtextbox the the user can change the color and font in the message. Below is the code I am using which ends up send in Text Format. Most codes I have found use System.WebMail which in vb 2008 is obsolete. This snippet is using System.Net.Mail namespace.

Public Shared Function SendEmailMessage(ByVal sendTo As String, _
                                 ByVal sendFrom As String, _
                                 ByVal sendSubject As String, _
                                 ByVal sendMessage As String, _
                                 Optional ByVal toBcc As ArrayList = Nothing, _
                                 Optional ByVal attachments As ArrayList = Nothing) As String
Dim message As New MailMessage()
                With message
                    .From = New MailAddress(sendFrom)
                    .To.Add(sendTo)
                    .Subject = sendSubject
                    .IsBodyHtml = True
                    .Body = sendMessage
                End With

Thanks
Charles

Recommended Answers

All 2 Replies

>Sending HTML Msg. using system.net.mail

HTML mail message requires Mime type (text/html). Take a look at this MSDN article.

Thanks for the reply.
I saw this article. It is written in C# (which I know how to convert) but also very cufusing. In the end, with this take the RTF format from a richtextbox and convert it?

>Sending HTML Msg. using system.net.mail

HTML mail message requires Mime type (text/html). Take a look at this MSDN article.

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.