Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Send HTML Email from ASP.NET (http://www.velocityreviews.com/forums/t94368-send-html-email-from-asp-net.html)

=?Utf-8?B?UmljaCBSZWtvcw==?= 01-12-2005 05:07 PM

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 = "richard.rekos@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

Steve C. Orr [MVP, MCSD] 01-12-2005 06:11 PM

Re: Send HTML Email from ASP.NET
 
What is body.text?
Is HTML in there?

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



"Rich Rekos" <RichRekos@discussions.microsoft.com> wrote in message
news:19849028-ECD7-4656-AEB7-DFD49AD0FAF3@microsoft.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 = "richard.rekos@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




=?Utf-8?B?UmljaCBSZWtvcw==?= 01-12-2005 07:53 PM

Re: Send HTML Email from ASP.NET
 
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" <RichRekos@discussions.microsoft.com> wrote in message
> news:19849028-ECD7-4656-AEB7-DFD49AD0FAF3@microsoft.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 = "richard.rekos@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

>
>
>


=?Utf-8?B?VGVycnk=?= 01-12-2005 09:15 PM

Re: Send HTML Email from ASP.NET
 
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" <RichRekos@discussions.microsoft.com> wrote in message
> > news:19849028-ECD7-4656-AEB7-DFD49AD0FAF3@microsoft.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 = "richard.rekos@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

> >
> >
> >


MWells 01-12-2005 09:19 PM

Re: Send HTML Email from ASP.NET
 
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" <RichRekos@discussions.microsoft.com> wrote in message
news:31D26F47-4A7A-4782-AF23-B800F208284F@microsoft.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" <RichRekos@discussions.microsoft.com> wrote in message
> > news:19849028-ECD7-4656-AEB7-DFD49AD0FAF3@microsoft.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 = "richard.rekos@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

> >
> >
> >




=?Utf-8?B?UmljaCBSZWtvcw==?= 01-12-2005 09:35 PM

Re: Send HTML Email from ASP.NET
 
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" <RichRekos@discussions.microsoft.com> wrote in message
> news:31D26F47-4A7A-4782-AF23-B800F208284F@microsoft.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" <RichRekos@discussions.microsoft.com> wrote in message
> > > news:19849028-ECD7-4656-AEB7-DFD49AD0FAF3@microsoft.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 = "richard.rekos@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
> > >
> > >
> > >

>
>
>


MWells 01-12-2005 11:19 PM

Re: Send HTML Email from ASP.NET
 
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" <RichRekos@discussions.microsoft.com> wrote in message
news:803599DB-CDB9-42C0-8D09-63EEE47934A2@microsoft.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" <RichRekos@discussions.microsoft.com> wrote in message
> > news:31D26F47-4A7A-4782-AF23-B800F208284F@microsoft.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" <RichRekos@discussions.microsoft.com> wrote in message
> > > > news:19849028-ECD7-4656-AEB7-DFD49AD0FAF3@microsoft.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 = "richard.rekos@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
> > > >
> > > >
> > > >

> >
> >
> >




=?Utf-8?B?UmljaCBSZWtvcw==?= 01-13-2005 01:51 PM

Re: Send HTML Email from ASP.NET
 
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" <RichRekos@discussions.microsoft.com> wrote in message
> news:803599DB-CDB9-42C0-8D09-63EEE47934A2@microsoft.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" <RichRekos@discussions.microsoft.com> wrote in message
> > > news:31D26F47-4A7A-4782-AF23-B800F208284F@microsoft.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" <RichRekos@discussions.microsoft.com> wrote in message
> > > > > news:19849028-ECD7-4656-AEB7-DFD49AD0FAF3@microsoft.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 = "richard.rekos@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
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >

>
>
>



All times are GMT. The time now is 11:54 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.