![]() |
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 |
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 |
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 > > > |
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 > > > > > > |
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 > > > > > > |
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 > > > > > > > > > > > > |
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 > > > > > > > > > > > > > > > > > > |
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.