473,382 Members | 1,386 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,382 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 2193
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 .=...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.