Avatar of mj168
mj168 asked on

Placing line breaks in an email

I am using VB for my ASP.Net website. I need to include line breaks in my email. However they are not being created. They are literally displaying in the email as "<br/><br/><br/>".      

   Dim thisMessage As String = "Email Content" + <br/> + <br/> + <br/> + "More Email Content"

   Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()

        mailMessage.Subject = "An email"

        mailMessage.Body = thisMessage

Avatar of undefined
Last Comment
Éric Moreau

8/22/2022 - Mon
Kumaraswamy R

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

It would only be shown correctly if you define your MailMessage to be a html-message. if it is plain text you need to add "\r\n" instead of "<br/>"

There is a IsBodyHtml property to get the information about the body type.
Éric Moreau

this is because you are sending plain text email (the default). In this mode, replace the <br/> with environment.newline.

if you want to use <br />, switch to html mode
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck