New Line in E-mail Body
(all I want to see is the string part to be assigned to the body, thanks)
(all I want to see is the string part to be assigned to the body, thanks)
well if the email is in HTML format then you need to use html tags.
<br> is an html tag for line break - does this work for you?
Hi there,
This example works (tested). If your are using HTML, you'll need to listen to ahmed ![]()
System.Net.Mail.MailMessage m =
new System.Net.Mail.MailMessage("me@mydomain.com", "you@yourdomain.com");
m.Body = string.Format("Hello,{0}{0}this is the second line", "\r\n");
System.Net.Mail.SmtpClient c = new System.Net.Mail.SmtpClient("somestmp.somedomain.com", 25);
c.Send(m);
Regards,
Do I have to specify any settings in order to allow for an HTML body?
yup!
in the MailMessage object, set the "IsBodyHtml" to true, this will make the body of the mail message in html format :-)
Example:
MailMessage theEmail = new MailMessage();
theEmail.IsBodyHtml = true;
..
..