473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Send HTML Email from ASP.NET

I can't seem to get messages to be sent in HTML format. All of my test
messages arrive in my inbox in text format. Please see code below. Am I
missing something? I specified HTML as the body format:

<script language="vb" runat="server">

Sub sendmessage_Click(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@questionmark.com"
objMail.BodyFormat = System.Web.Mail.MailFormat.Html

objMail.Subject = "Subject.Text"

objMail.Body = body.text
SmtpMail.SmtpServer = "localhost"

SmtpMail.Send(objMail)
message.Text = "Your Email was sent successfully"

End Sub

</script>

Thanks, Rich
Nov 19 '05 #1
7 2190
What is body.text?
Is HTML in there?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
I can't seem to get messages to be sent in HTML format. All of my test
messages arrive in my inbox in text format. Please see code below. Am I
missing something? I specified HTML as the body format:

<script language="vb" runat="server">

Sub sendmessage_Click(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@questionmark.com"
objMail.BodyFormat = System.Web.Mail.MailFormat.Html

objMail.Subject = "Subject.Text"

objMail.Body = body.text
SmtpMail.SmtpServer = "localhost"

SmtpMail.Send(objMail)
message.Text = "Your Email was sent successfully"

End Sub

</script>

Thanks, Rich

Nov 19 '05 #2
Nope, no html there, is that the problem? See below:

<font face="MS Reference Sans Serif" size="2">Body of Message:</b></font><br>
<asp:textbox id="body" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" />
"Steve C. Orr [MVP, MCSD]" wrote:
What is body.text?
Is HTML in there?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
I can't seem to get messages to be sent in HTML format. All of my test
messages arrive in my inbox in text format. Please see code below. Am I
missing something? I specified HTML as the body format:

<script language="vb" runat="server">

Sub sendmessage_Click(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@questionmark.com"
objMail.BodyFormat = System.Web.Mail.MailFormat.Html

objMail.Subject = "Subject.Text"

objMail.Body = body.text
SmtpMail.SmtpServer = "localhost"

SmtpMail.Send(objMail)
message.Text = "Your Email was sent successfully"

End Sub

</script>

Thanks, Rich


Nov 19 '05 #3
Remember that HTML is a markup language. If you users enter "this is a
test" into your textbox, that's perfectly valid HTML and will be emailed to
you and rendered as perfectly ordinary looking text.

If your users enter markup, e.g. "this is a <b>test</b>", then when your
mail reader renders it as HTML, you should see the effects of the markup.
"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
Nope, no html there, is that the problem? See below:

<font face="MS Reference Sans Serif" size="2">Body of Message:</b></font><br> <asp:textbox id="body" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" />
"Steve C. Orr [MVP, MCSD]" wrote:
What is body.text?
Is HTML in there?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
I can't seem to get messages to be sent in HTML format. All of my test
messages arrive in my inbox in text format. Please see code below. Am I missing something? I specified HTML as the body format:

<script language="vb" runat="server">

Sub sendmessage_Click(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@questionmark.com"
objMail.BodyFormat = System.Web.Mail.MailFormat.Html

objMail.Subject = "Subject.Text"

objMail.Body = body.text
SmtpMail.SmtpServer = "localhost"

SmtpMail.Send(objMail)
message.Text = "Your Email was sent successfully"

End Sub

</script>

Thanks, Rich


Nov 19 '05 #4
Yes, that looks like it would be the problem. Try typing a simple HTML string
in like: <B>Hello World</B>, and see what happens.

"Rich Rekos" wrote:
Nope, no html there, is that the problem? See below:

<font face="MS Reference Sans Serif" size="2">Body of Message:</b></font><br>
<asp:textbox id="body" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" />
"Steve C. Orr [MVP, MCSD]" wrote:
What is body.text?
Is HTML in there?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
I can't seem to get messages to be sent in HTML format. All of my test
messages arrive in my inbox in text format. Please see code below. Am I
missing something? I specified HTML as the body format:

<script language="vb" runat="server">

Sub sendmessage_Click(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@questionmark.com"
objMail.BodyFormat = System.Web.Mail.MailFormat.Html

objMail.Subject = "Subject.Text"

objMail.Body = body.text
SmtpMail.SmtpServer = "localhost"

SmtpMail.Send(objMail)
message.Text = "Your Email was sent successfully"

End Sub

</script>

Thanks, Rich


Nov 19 '05 #5
Great, thanks, will do. I am new to this and I guess I expected the html to
magically write itself ;) Thanks!

"MWells" wrote:
Remember that HTML is a markup language. If you users enter "this is a
test" into your textbox, that's perfectly valid HTML and will be emailed to
you and rendered as perfectly ordinary looking text.

If your users enter markup, e.g. "this is a <b>test</b>", then when your
mail reader renders it as HTML, you should see the effects of the markup.
"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
Nope, no html there, is that the problem? See below:

<font face="MS Reference Sans Serif" size="2">Body of

Message:</b></font><br>
<asp:textbox id="body" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" />
"Steve C. Orr [MVP, MCSD]" wrote:
What is body.text?
Is HTML in there?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
>I can't seem to get messages to be sent in HTML format. All of my test
> messages arrive in my inbox in text format. Please see code below. Am I > missing something? I specified HTML as the body format:
>
> <script language="vb" runat="server">
>
> Sub sendmessage_Click(sender as Object, e as EventArgs)
>
>
> Dim objMail as New MailMessage()
>
> objMail.To = Email.Text
> objMail.From = "ri***********@questionmark.com"
> objMail.BodyFormat = System.Web.Mail.MailFormat.Html
>
> objMail.Subject = "Subject.Text"
>
> objMail.Body = body.text
> SmtpMail.SmtpServer = "localhost"
>
> SmtpMail.Send(objMail)
> message.Text = "Your Email was sent successfully"
>
> End Sub
>
> </script>
>
> Thanks, Rich


Nov 19 '05 #6
That would be a neat trick, but probably not very pretty.

If the app you're developing really needs some decent HTML-input
capabilities, take a look at;

http://www.richercomponents.com/richtextbox/

RichTextBox allows you to enter your content in a wysiwyg mode. Very clean
and feature-rich. You users will burn incense in your honor.

There are almost certainly other similar controls, and some may be free, so
shop around.
"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
Great, thanks, will do. I am new to this and I guess I expected the html to magically write itself ;) Thanks!

"MWells" wrote:
Remember that HTML is a markup language. If you users enter "this is a
test" into your textbox, that's perfectly valid HTML and will be emailed to you and rendered as perfectly ordinary looking text.

If your users enter markup, e.g. "this is a <b>test</b>", then when your
mail reader renders it as HTML, you should see the effects of the markup.

"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
Nope, no html there, is that the problem? See below:

<font face="MS Reference Sans Serif" size="2">Body of

Message:</b></font><br>
<asp:textbox id="body" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" />
"Steve C. Orr [MVP, MCSD]" wrote:

> What is body.text?
> Is HTML in there?
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
>
>
> "Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
> news:19**********************************@microsof t.com...
> >I can't seem to get messages to be sent in HTML format. All of my test > > messages arrive in my inbox in text format. Please see code
below. Am I
> > missing something? I specified HTML as the body format:
> >
> > <script language="vb" runat="server">
> >
> > Sub sendmessage_Click(sender as Object, e as EventArgs)
> >
> >
> > Dim objMail as New MailMessage()
> >
> > objMail.To = Email.Text
> > objMail.From = "ri***********@questionmark.com"
> > objMail.BodyFormat = System.Web.Mail.MailFormat.Html
> >
> > objMail.Subject = "Subject.Text"
> >
> > objMail.Body = body.text
> > SmtpMail.SmtpServer = "localhost"
> >
> > SmtpMail.Send(objMail)
> > message.Text = "Your Email was sent successfully"
> >
> > End Sub
> >
> > </script>
> >
> > Thanks, Rich
>
>
>


Nov 19 '05 #7
Fantastic, thanks for the tip.

Rich

"MWells" wrote:
That would be a neat trick, but probably not very pretty.

If the app you're developing really needs some decent HTML-input
capabilities, take a look at;

http://www.richercomponents.com/richtextbox/

RichTextBox allows you to enter your content in a wysiwyg mode. Very clean
and feature-rich. You users will burn incense in your honor.

There are almost certainly other similar controls, and some may be free, so
shop around.
"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
Great, thanks, will do. I am new to this and I guess I expected the html

to
magically write itself ;) Thanks!

"MWells" wrote:
Remember that HTML is a markup language. If you users enter "this is a
test" into your textbox, that's perfectly valid HTML and will be emailed to you and rendered as perfectly ordinary looking text.

If your users enter markup, e.g. "this is a <b>test</b>", then when your
mail reader renders it as HTML, you should see the effects of the markup.

"Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
> Nope, no html there, is that the problem? See below:
>
> <font face="MS Reference Sans Serif" size="2">Body of
Message:</b></font><br>
> <asp:textbox id="body" TextMode="MultiLine"
> Columns="40" Rows="10" runat="server" />
>
>
> "Steve C. Orr [MVP, MCSD]" wrote:
>
> > What is body.text?
> > Is HTML in there?
> >
> > --
> > I hope this helps,
> > Steve C. Orr, MCSD, MVP
> > http://SteveOrr.net
> >
> >
> >
> > "Rich Rekos" <Ri*******@discussions.microsoft.com> wrote in message
> > news:19**********************************@microsof t.com...
> > >I can't seem to get messages to be sent in HTML format. All of my test > > > messages arrive in my inbox in text format. Please see code below. Am I
> > > missing something? I specified HTML as the body format:
> > >
> > > <script language="vb" runat="server">
> > >
> > > Sub sendmessage_Click(sender as Object, e as EventArgs)
> > >
> > >
> > > Dim objMail as New MailMessage()
> > >
> > > objMail.To = Email.Text
> > > objMail.From = "ri***********@questionmark.com"
> > > objMail.BodyFormat = System.Web.Mail.MailFormat.Html
> > >
> > > objMail.Subject = "Subject.Text"
> > >
> > > objMail.Body = body.text
> > > SmtpMail.SmtpServer = "localhost"
> > >
> > > SmtpMail.Send(objMail)
> > > message.Text = "Your Email was sent successfully"
> > >
> > > End Sub
> > >
> > > </script>
> > >
> > > Thanks, Rich
> >
> >
> >


Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Google Mike | last post by:
I've got RH9 Linux with default PHP. Is there a way to send email on Linux to an Exchange Server from PHP and/or other tools when there is *NOT* SMTP access? Has anyone figured out a way to...
1
by: Kenshin | last post by:
Hey! I have another script where i pull all the information from the database and I want to send it to the person. What they do is they enter in their email, and if the email matches, than it will...
6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
2
by: David Lozzi | last post by:
Howdy, I'm new to .Net 2.0... Getting "System.Net.Mail.SmtpException: The operation has timed out" on this script at the smtpClient.Send(msg) line Dim msg As New MailMessage
2
by: Malli mindwave | last post by:
Hi, We are using the yahoowebHostiing service for my company website, In that one screen of the SendComments/FeedBack section is there, I'm basically dot.net develeoper ,but yahoowebhosting not...
2
by: kennykenn | last post by:
Hi, Ive producd code to send an email after capturing info off a form,it works fine locally but when i put it live it doesnt work! the code is stopin at 'msg.send' any ideas, here the code! ...
6
by: =?Utf-8?B?TMOhemFybw==?= | last post by:
Hi everyone I've a simple ASP.NET Page that send a email using smtclient. The server is a Exchange and use my credentials to autentificated. The problem is that the send mail appear in the...
3
digicrowd
by: digicrowd | last post by:
http://bytes.com/images/howtos/applemail_sig_icon.jpg You can make your emails fancy in Mail.app by using Rich Text formatting or even included Stationery. But, a simple way to send your own HTML...
2
by: anu b | last post by:
Now i am sending email to my friend using session variable... but my code is as below private bool SendEmail(string email) { try
2
by: urbanedge | last post by:
I've just acquired a site and uploaded to godaddy and the email function won't work. I'm new to php and I'm not able to determine where the issue is. I've commented out $this->header .=...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.