Programatically create formatted / rich text to send in an email

I need  to send formatted text (bullet points, bolded words etc...)  in an email from our app.  I must also fill in some of the information from the database.   Such as names, order details etc..  

The code snippet details how I am sending the email which works.

How can I send this in the body of the email with all the formatting they requested?

Thanks!


 


 

Dim StringCommand As New System.Text.StringBuilder
 
        StringCommand.Append("mailto:")
        StringCommand.Append(Recipient)
        StringCommand.Append("?")
 
        If Subject <> "" Then
            StringCommand.Append("subject=" & Subject & "&")
        End If
 
        If CC <> "" Then
            StringCommand.Append("cc=" & CC & "&")
        End If
 
        If BCC <> "" Then
            StringCommand.Append("bcc=" & BCC & "&")
        End If
 
 
        If Body <> "" Then
            StringCommand.Append("body=" & Body & "&")
        End If
 
   
        System.Diagnostics.Process.Start(StringCommand.ToString)

Open in new window

KimberleyYAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason EvansSenior Software DeveloperCommented:
Hi KimberleyY.

You should look at using objects in the System.Net.Mail namespace in order to get HTML sent. Have a look at the example code.

Hope this helps.
Jas.
Imports System.Net.Mail 
Public Class MyEmail 
    Public Sub SendEmail()
        Dim msg As New MailMessage
        Dim smtpServer As New SmtpClient 
        smtpServer.Port = 25
        smtpServer.Host = "nameofemailserver"
        smtpServer.Credentials = New Net.NetworkCredential("username", "password") 
        msg.Body = "<h1>Test</h1>"
        msg.IsBodyHtml = True 
        smtpServer.Send(msg)
    End Sub
End Class

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KimberleyYAuthor Commented:
Hi MrClyfar,

Thanks!  I was afradi that the message needed to be in HTML.  I did find some free converters for rtf to html.  And I will also look into the System.Net.Mail namespace.

Thanks Again
0
KimberleyYAuthor Commented:
Good Job
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.