Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Send HTML Email from ASP.NET

Reply
Thread Tools

Send HTML Email from ASP.NET

 
 
=?Utf-8?B?UmljaCBSZWtvcw==?=
Guest
Posts: n/a
 
      01-12-2005
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 = "(E-Mail Removed)"
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
 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      01-12-2005
What is body.text?
Is HTML in there?

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



"Rich Rekos" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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 = "(E-Mail Removed)"
> 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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?UmljaCBSZWtvcw==?=
Guest
Posts: n/a
 
      01-12-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >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 = "(E-Mail Removed)"
> > 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

>
>
>

 
Reply With Quote
 
=?Utf-8?B?VGVycnk=?=
Guest
Posts: n/a
 
      01-12-2005
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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > >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 = "(E-Mail Removed)"
> > > 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

> >
> >
> >

 
Reply With Quote
 
MWells
Guest
Posts: n/a
 
      01-12-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > >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 = "(E-Mail Removed)"
> > > 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

> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?UmljaCBSZWtvcw==?=
Guest
Posts: n/a
 
      01-12-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > >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 = "(E-Mail Removed)"
> > > > 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
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
MWells
Guest
Posts: n/a
 
      01-12-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > >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 = "(E-Mail Removed)"
> > > > > 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
> > > >
> > > >
> > > >

> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?UmljaCBSZWtvcw==?=
Guest
Posts: n/a
 
      01-13-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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" <(E-Mail Removed)> wrote in message
> > > > > news:(E-Mail Removed)...
> > > > > >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 = "(E-Mail Removed)"
> > > > > > 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
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
which email module - MIME::LITE, Email::Send, other? brewsterbear@googlemail.com Perl Misc 2 01-05-2007 09:45 AM
How to have email form send email and start file download bmurphy@xlrotor.com Javascript 13 05-14-2006 06:27 PM
Cannot compose ,reply or send email on Sasktel email system pcbutts1 Computer Support 5 07-29-2005 06:13 AM
why cant i send email messages from this email Billie Jo Ames Computer Support 8 06-30-2005 12:24 PM
HowTo:? open email client to send email Peter ASP .Net 0 07-01-2003 04:58 PM



Advertisments