tags:

views:

596

answers:

3

how to send rich text message in system.net.mail need code for send a mail as html

+3  A: 
System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();
mm.Body = "<html>...</html>";
mm.IsBodyHtml = true;
Vincent McNabb
+1  A: 
//create the mail message
 MailMessage mail = new MailMessage();

 //set the addresses
 mail.From = new MailAddress("[email protected]");
 mail.To.Add("[email protected]");

 //set the content
 mail.Subject = "This is an email";
 mail.Body = "<b>This is bold</b> <font color=#336699>This is blue</font>";
 mail.IsBodyHtml = true;

 //send the message
 SmtpClient smtp = new SmtpClient("127.0.0.1");
 smtp.Send(mail);
Ryan Farley
+1  A: 

You should be aware, that not every person/mailclient can present a message formatted in HTML. If you rely on layout to make your message clear this can be a problem.

GvS