View Full Version : ASP SMTPsvg.Mailer
flashermx
August 18th, 2003, 10:38 PM
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:
abzoid
August 18th, 2003, 11:16 PM
<BR> or <P> doesn't work?
flashermx
August 19th, 2003, 08:06 PM
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 = "<b>The following is feedback from my web site.</b><br>"
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
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:
abzoid
August 19th, 2003, 08:18 PM
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
flashermx
August 20th, 2003, 10:49 PM
Thanks abzoid that was it. I knew it had to do with my syntax. Great!
Thanks
:ch:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.