Mail in HTML Format

Discussion in 'ASP .Net Web Controls' started by Neel, Nov 11, 2003.

  1. Neel

    Neel Guest

    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
    Neel, Nov 11, 2003
    #1
    1. Advertising

  2. Neel

    Jason Guest

    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();


    "Neel" <> wrote in message
    news:10a601c3a895$f4970fc0$...
    > 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
    >
    Jason, Nov 19, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Turley

    How to send mail in HTML format

    Paul Turley, Jul 27, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    507
    Parker Zhang [MSFT]
    Jul 29, 2003
  2. Ofir Amitai

    can't send mail in html format

    Ofir Amitai, Aug 19, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    1,800
    MS News \(MS ILM\)
    Aug 19, 2003
  3. =?Utf-8?B?TWlja2VCb3k=?=

    Problem with System.Web.Mail.MailMessage and HTML mail

    =?Utf-8?B?TWlja2VCb3k=?=, Jun 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    892
    =?Utf-8?B?TWlja2VCb3k=?=
    Jun 21, 2005
  4. Amit Kumar

    mail the file in html format ?

    Amit Kumar, Mar 13, 2007, in forum: Java
    Replies:
    0
    Views:
    250
    Amit Kumar
    Mar 13, 2007
  5. Ramon
    Replies:
    2
    Views:
    989
    Ramon
    Oct 25, 2007
Loading...

Share This Page