Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I don't think testimonials would have enticed me to become a member, or even use the site for that matter. I use the site for a learning experience..."

Geography

Where in the world do Tek-Tips members come from?

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

yaknowss (Programmer)
27 Jul 12 11:18
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";
EmailMsg.Body = CurrentTime.Text + "," + txtName.Text + "," + txtDepartment.Text + "," + txtWebsite.Text;
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!!
jbenson001 (Programmer)
27 Jul 12 13:17
Set the format of the email to HTML
then use "<br />" instead of the commas
yaknowss (Programmer)
27 Jul 12 13:20
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; 
jbenson001 (Programmer)
27 Jul 12 14:26
That should do it as far as I know

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close