Click here to Skip to main content
13,705,081 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
How to add new line in email body in vb.net
i have tried Environment.NewLine.
but in my email it is not going to new line. whole text coming in single line.

What I have tried:

message.body="Date: " & 14-09-2018 & Environment.NewLine &
Posted 14-Sep-18 2:32am
Updated 14-Sep-18 4:38am
Comments
MadMyche 14-Sep-18 9:22am
   
What is the email body type; plain-text or HTML?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

If the body of your message needs to be in HTML format, you need to set IsBodyHtml to true and simply add the <br> tags in your String. Environment.NewLine, vbCrLf and StringBuilder.AppendLine will not work if the body is in HTML format.

You could try like this:

Dim mail As New MailMessage
mail.IsBodyHtml = True
mail.Body = "First Line <br> Second Line <br> Third Line <br> Fourth Line"
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 14 Sep 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100