Reputation:
how to send rich text message in system.net.mail need code for send a mail as html
Upvotes: 0
Views: 3124
Reputation: 52518
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.
Upvotes: 1
Reputation: 11431
//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);
Upvotes: 1
Reputation: 34689
System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();
mm.Body = "<html>...</html>";
mm.IsBodyHtml = true;
Upvotes: 3