Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System.Net.Mail - Add a page break in EmailMsg.Body

Status
Not open for further replies.

yaknowss

Programmer
Apr 19, 2012
69
US
I am trying to pull in data from a web form into an email body. The fields are showing up in my email, but i want to format the body of the email message so it is visually appealing. When I apply the code below, it seperates with a comma and I want to know how can I seperate the passing data with a page break? The underlined code below is what id like to modify.

Code:
//send new confirmation email
MailMessage EmailMsg = new MailMessage();
EmailMsg.From = new MailAddress("insert email address", "insert sender name");
EmailMsg.To.Add(new MailAddress("insert email address", "insert friendly name"));
EmailMsg.Subject = "Insert Subject";
[u]EmailMsg.Body = CurrentTime.Text + "," + txtName.Text + "," + txtDepartment.Text + "," + txtWebsite.Text;[/u]
EmailMsg.IsBodyHtml = true;
EmailMsg.Priority = MailPriority.Normal;
SmtpClient MailClient = new SmtpClient("insert server name");
MailClient.Credentials = new System.Net.NetworkCredential("insert username", "insert password");
                        MailClient.Send(EmailMsg);

Any ideas? Thank you in advance!!
 
Set the format of the email to HTML
then use "<br />" instead of the commas
 
Can you please explain how to set the format of the email to html? I thought I already had it set to HTML...

Code:
EmailMsg.IsBodyHtml = true;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top