473,796 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Cli ck(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@ questionmark.co m"
objMail.BodyFor mat = System.Web.Mail .MailFormat.Htm l

objMail.Subject = "Subject.Te xt"

objMail.Body = body.text
SmtpMail.SmtpSe rver = "localhost"

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

End Sub

</script>

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

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

"Rich Rekos" <Ri*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ***********@mic rosoft.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_Cli ck(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@ questionmark.co m"
objMail.BodyFor mat = System.Web.Mail .MailFormat.Htm l

objMail.Subject = "Subject.Te xt"

objMail.Body = body.text
SmtpMail.SmtpSe rver = "localhost"

SmtpMail.Send(o bjMail)
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="Multi Line"
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*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ***********@mic rosoft.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_Cli ck(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@ questionmark.co m"
objMail.BodyFor mat = System.Web.Mail .MailFormat.Htm l

objMail.Subject = "Subject.Te xt"

objMail.Body = body.text
SmtpMail.SmtpSe rver = "localhost"

SmtpMail.Send(o bjMail)
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*******@disc ussions.microso ft.com> wrote in message
news:31******** *************** ***********@mic rosoft.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="Multi Line"
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*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ***********@mic rosoft.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_Cli ck(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@ questionmark.co m"
objMail.BodyFor mat = System.Web.Mail .MailFormat.Htm l

objMail.Subject = "Subject.Te xt"

objMail.Body = body.text
SmtpMail.SmtpSe rver = "localhost"

SmtpMail.Send(o bjMail)
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="Multi Line"
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*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ***********@mic rosoft.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_Cli ck(sender as Object, e as EventArgs)
Dim objMail as New MailMessage()

objMail.To = Email.Text
objMail.From = "ri***********@ questionmark.co m"
objMail.BodyFor mat = System.Web.Mail .MailFormat.Htm l

objMail.Subject = "Subject.Te xt"

objMail.Body = body.text
SmtpMail.SmtpSe rver = "localhost"

SmtpMail.Send(o bjMail)
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*******@disc ussions.microso ft.com> wrote in message
news:31******** *************** ***********@mic rosoft.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="Multi Line"
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*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ***********@mic rosoft.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_Cli ck(sender as Object, e as EventArgs)
>
>
> Dim objMail as New MailMessage()
>
> objMail.To = Email.Text
> objMail.From = "ri***********@ questionmark.co m"
> objMail.BodyFor mat = System.Web.Mail .MailFormat.Htm l
>
> objMail.Subject = "Subject.Te xt"
>
> objMail.Body = body.text
> SmtpMail.SmtpSe rver = "localhost"
>
> SmtpMail.Send(o bjMail)
> 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*******@disc ussions.microso ft.com> wrote in message
news:80******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:31******** *************** ***********@mic rosoft.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="Multi Line"
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*******@disc ussions.microso ft.com> wrote in message
> news:19******** *************** ***********@mic rosoft.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_Cli ck(sender as Object, e as EventArgs)
> >
> >
> > Dim objMail as New MailMessage()
> >
> > objMail.To = Email.Text
> > objMail.From = "ri***********@ questionmark.co m"
> > objMail.BodyFor mat = System.Web.Mail .MailFormat.Htm l
> >
> > objMail.Subject = "Subject.Te xt"
> >
> > objMail.Body = body.text
> > SmtpMail.SmtpSe rver = "localhost"
> >
> > SmtpMail.Send(o bjMail)
> > 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*******@disc ussions.microso ft.com> wrote in message
news:80******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:31******** *************** ***********@mic rosoft.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="Multi Line"
> 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*******@disc ussions.microso ft.com> wrote in message
> > news:19******** *************** ***********@mic rosoft.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_Cli ck(sender as Object, e as EventArgs)
> > >
> > >
> > > Dim objMail as New MailMessage()
> > >
> > > objMail.To = Email.Text
> > > objMail.From = "ri***********@ questionmark.co m"
> > > objMail.BodyFor mat = System.Web.Mail .MailFormat.Htm l
> > >
> > > objMail.Subject = "Subject.Te xt"
> > >
> > > objMail.Body = body.text
> > > SmtpMail.SmtpSe rver = "localhost"
> > >
> > > SmtpMail.Send(o bjMail)
> > > 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
12094
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 use PHP to get inside an OWA (Microsoft Outlook Web Access) website to send email that way? The reason I ask is because my corporate office is going to do away with our rogue SMTP server access and force everything through Exchange
1
1879
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 email them their login information. How do you grab the info and than use that info and put it into an email to send? Here is my code thus far for it:
6
11194
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 will include the code I originally used. I understand I should switch from CDONTS to CDO mail but after several sttempts I am finding a very hard time getting the new CDO mail to work properly. Any assistance with this would be greatly...
2
5270
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
5637
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 support .asp,.aspx files, it supports PHP files, I'm searching in JavaScript ,but not found any matter, I'don't Know PHP.I'm having lot of pressure of higer officials.Please help me on this.
2
2492
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
5938
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 junk email folder. Any idea. Thanks
3
100097
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 creation (or any web page for that matter) is to use Safari. Follow these four easy steps. 1. Create the HTML Layout your HTML code including any images or graphics you'd like to include. In this example, we will make a simple birthday email to add...
2
18175
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
1838
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 .= $this->body; and I get a blank email to send. I've stripped down the body file but there still seems to be a problem. I'm not sure where to look now. This is the body file. <?php /******************** EMAIL ***************************/ $sRuta =...
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10230
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10012
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.