ASP SMTPsvg.Mailer

I’m using this server object to send emails to my account from data put into a form. When I set the Mailer properties to text/html all works and I can code in html but I can’t create line breaks after my form requests & VBCrLf wont work because I’m formating in html. What to do.

:mario:

<BR> or <P> doesn’t work?

Here is the code without the html:

Set Mailer = Server.CreateObject(“SMTPsvg.Mailer”)

Mailer.FromName   = Request.Form ("from")

Mailer.FromAddress= Request.Form("email address")

Mailer.RemoteHost = "privacy"

Mailer.AddRecipient "privacy"

Mailer.Subject    = "Web Site"

sBodyText = "The following is feedback from my web site." & VBCrLf

sBodyText = sBodyText & "Favorite color Is " & Request.Form("color")& VBCrLf

sBodyText = sBodyText & "The gender is " & Request.Form("gender")& VBCrLf

sBodyText = sBodyText & "" & request.form("comments")

Mailer.BodyText = sBodyText 

Mailer.SendMail

Response.redirect "privacy.asp"

Response.end

This works. Below is the code with the HTML

Set Mailer = Server.CreateObject(“SMTPsvg.Mailer”)

Mailer.FromName   = Request.Form ("from")

Mailer.FromAddress= Request.Form("email address")

Mailer.RemoteHost = "privacy"

Mailer.AddRecipient "privacy"

Mailer.Subject    = "Web Site"

sBodyText = "&lt;b&gt;The following is feedback from my web site.&lt;/b&gt;&lt;br&gt;"

sBodyText = sBodyText & "&lt;b&gt;Favorite color Is &lt;/b&gt;" & Request.Form("color")&lt;br&gt;

sBodyText = sBodyText & "&lt;b&gt;The gender is&lt;/b&gt; " & Request.Form("gender")&lt;br&gt;

sBodyText = sBodyText & "" & request.form("comments")

            Mailer.ContentType = "text/html"

Mailer.BodyText = sBodyText 


Mailer.SendMail

Response.redirect "privacy.asp"

Response.end

With the <br> an error is produced. Without it the form works but the text is in one long line when it comes to the part with the Request.Form. What to do? Forget the html formatting?:pope:

Unless I’ve misread the documentation, the following should work.

sBodyText = “<b>The following is feedback from my web site.</b><p>”

sBodyText = sBodyText & “<b>Favorite color Is </b>” & Request.Form(“color”) & “<br>”

sBodyText = sBodyText & “<b>The gender is </b>” & Request.Form(“gender”) & “<br>”

sBodyText = sBodyText & “” & request.form(“comments”)

Mailer.ContentType = “text/html”

Mailer.BodyText = sBodyText

http://www.serverobjects.com/comp/Aspmail4.htm

Thanks abzoid that was it. I knew it had to do with my syntax. Great!

Thanks

:ch: