Mail in HTML Format

N

Neel

Hi

I have a webpage in asp.net on submit sends an email, I
want the body of the message to be in the HTML format.

what I am doing is creating an object of
say
oMailMessage = New Mail.MailMessage()

With oMailMessage

'set required parameters
.From =
.To =
.Subject =
.Body =
.BodyFormat = MailFormat.Html

End Withwith

but still I am getting an email in the text format,

can anyone suggest me at the earliest, thanks in advance
 
J

Jason

You should just add html to the body and it should work.

Here's an example from an old project:

StringBuilder body = new StringBuilder("<html><body><table
bgcolor='#DCDCDC'><tr bgcolor='#EEEEEE'><td>Message From: </td><td>");

body.Append(EmailName.Text);

body.Append("</td></tr><tr><td>Login User Name: </td><td>");

body.Append(Context.User.Identity.Name);

body.Append("</td></tr><tr bgcolor='#EEEEEE'><td>Starting Date: </td><td>");

body.Append(Calendar1.SelectedDate.ToShortDateString());

body.Append("</td></tr><tr><td>StartTime: </td><td>");

body.Append(EmailStartTime.SelectedItem.ToString());

body.Append("</td></tr><tr bgcolor='#EEEEEE'><td>EndTime: </td><td>");

body.Append(EmailEndTime.SelectedItem.ToString());

body.Append("</td></tr><tr><td>Description: </td><td>");

body.Append(EmailDescription.Text);

body.Append("</td></tr><tr bgcolor='#EEEEEE'><td>Network Cables:
</td><td>");

body.Append(NetworkCables.Text);

body.Append("</td></tr><tr><td>Extension Cords: </td><td>");

body.Append(ExtensionCords.Text);

body.Append("</td></tr><tr bgcolor='#EEEEEE'><td>Flip Charts: </td><td>");

body.Append(FlipCharts.Text);

body.Append("</td></tr><body><html></table>");

msg.Body = body.ToString();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top