Forums

ASP

This topic is locked

confirmation email sent from website form wrong

Posted 07 Nov 2006 17:50:44
1
has voted
07 Nov 2006 17:50:44 Franck Nowak posted:
greetings...
i'm new to the world of ASP and for the most part, i got everything working correctly on my website form... my issue is that i want to send a confirmation email to the person who filled out the form on the website i'm designing, but i can't get it to format correctly... i would like to send the email in HTML format or send a nicely designed pdf attachment, but i consistently get an 'unterminated line' error with any of the html code i have in the body... i've searched and found what i thought to be the answers for what i need to put in the code - but only got errors... i thought a good solution would be to send a pdf attachment of what i need sent to circumvent those who don't accept html, but i get errors again...

can anyone please point me in the right direction to some tutorials? i found a few, but nothing seems to work like i need it to... hopefully this all makes sense... maybe by seeing the code below, someone may suggest a completely different approach? if so, below is the code i'm using now (which successfully sends a small plain text message at the moment):

<font face='Tahoma'>&lt;%@LANGUAGE = "VBSCRIPT"%&gt;

&lt;%
'First lets Dim all the variables we need - this is a comment
Dim cname, cperson, faddy, fcsz, fphone, femail, ffax, fweburl, fproduct, fnopallets, fnoshipped

'Now lets get some values for the variables from the form
cname = Request.Form("companyname"
cperson = Request.Form("contactperson"
faddy = Request.Form("address"
fcsz = Request.Form("csz"
fphone = Request.Form("phone"
femail = Request.Form("email"
ffax = Request.Form("fax"
fweburl = Request.Form("website"
fproduct = Request.Form("producttype"
fnopallets = Request.Form("noofpallets"
fnoshipped = Request.Form("shippedpermonth"

'Now lets build the body of the email from the data in the form
MyBody = "Company Name: "& cname & vbcrlf
MyBody = MyBody & "Contact Person: "& cperson & vbcrlf
MyBody = MyBody & "Address: "& faddy & vbcrlf
MyBody = MyBody & "City, State, Zip: "& fcsz & vbcrlf
MyBody = MyBody & "Phone: "& fphone & vbcrlf
MyBody = MyBody & "Email: "& femail & vbcrlf
MyBody = MyBody & "Fax: "& ffax & vbcrlf
MyBody = MyBody & "Website URL:" & fweburl & vbcrlf & vbcrlf
MyBody = MyBody & "Product Type: "& fproduct & vbcrlf
MyBody = MyBody & "Number of Pallets: "& fnopallets & vbcrlf
MyBody = MyBody & "Number of Products Shipped per Month: "& fnoshipped & vbcrlf
MyBody = MyBody & MyComments

'Now lets put the variables and other information we need into the mailing script
Set MyMail = Server.CreateObject ("CDONTS.NewMail"
MyMail.From = femail
MyMail.To = " "
MyMail.Subject = "Quote Request"
MyMail.Body = MyBody
MyMail.Send
set MyMail=nothing

' send confirmation email to customer
Set MyMail = Server.CreateObject ("CDONTS.NewMail"
MyMail.From = " "
MyMail.To = Request.Form("email"
MyMail.Subject = "Information Request"
MyMail.Body = "Thank you for visiting the website. The information you filled out on our online form has been received and you will be contacted by one of our representatives shortly."
MyMail.Send

set MyMail=Nothing

Response.Redirect "thankyou.html"
%&gt;</font id='Tahoma'>


thanks in advance for any help...<font color=maroon></font id=maroon>

Edited by - IckyI on 07 Nov 2006 17:51:47

Replies

Replied 07 Nov 2006 17:55:02
07 Nov 2006 17:55:02 Franck Nowak replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
greetings...
i'm new to the world of ASP and for the most part, i got everything working correctly on my website form... my issue is that i want to send a confirmation email to the person who filled out the form on the website i'm designing, but i can't get it to format correctly... i would like to send the email in HTML format or send a nicely designed pdf attachment, but i consistently get an 'unterminated line' error with any of the html code i have in the body... i've searched and found what i thought to be the answers for what i need to put in the code - but only got errors... i thought a good solution would be to send a pdf attachment of what i need sent to circumvent those who don't accept html, but i get errors again...

can anyone please point me in the right direction to some tutorials? i found a few, but nothing seems to work like i need it to... hopefully this all makes sense... maybe by seeing the code below, someone may suggest a completely different approach? if so, below is the code i'm using now (which successfully sends a small plain text message at the moment):

<font color=maroon><font face='Tahoma'>&lt;%@LANGUAGE = "VBSCRIPT"%&gt;

&lt;%
'First lets Dim all the variables we need - this is a comment
Dim cname, cperson, faddy, fcsz, fphone, femail, ffax, fweburl, fproduct, fnopallets, fnoshipped

'Now lets get some values for the variables from the form
cname = Request.Form("companyname"
cperson = Request.Form("contactperson"
faddy = Request.Form("address"
fcsz = Request.Form("csz"
fphone = Request.Form("phone"
femail = Request.Form("email"
ffax = Request.Form("fax"
fweburl = Request.Form("website"
fproduct = Request.Form("producttype"
fnopallets = Request.Form("noofpallets"
fnoshipped = Request.Form("shippedpermonth"

'Now lets build the body of the email from the data in the form
MyBody = "Company Name: "& cname & vbcrlf
MyBody = MyBody & "Contact Person: "& cperson & vbcrlf
MyBody = MyBody & "Address: "& faddy & vbcrlf
MyBody = MyBody & "City, State, Zip: "& fcsz & vbcrlf
MyBody = MyBody & "Phone: "& fphone & vbcrlf
MyBody = MyBody & "Email: "& femail & vbcrlf
MyBody = MyBody & "Fax: "& ffax & vbcrlf
MyBody = MyBody & "Website URL:" & fweburl & vbcrlf & vbcrlf
MyBody = MyBody & "Product Type: "& fproduct & vbcrlf
MyBody = MyBody & "Number of Pallets: "& fnopallets & vbcrlf
MyBody = MyBody & "Number of Products Shipped per Month: "& fnoshipped & vbcrlf
MyBody = MyBody & MyComments

'Now lets put the variables and other information we need into the mailing script
Set MyMail = Server.CreateObject ("CDONTS.NewMail"
MyMail.From = femail
MyMail.To = " "
MyMail.Subject = "Quote Request"
MyMail.Body = MyBody
MyMail.Send
set MyMail=nothing

' send confirmation email to customer
Set MyMail = Server.CreateObject ("CDONTS.NewMail"
MyMail.From = " "
MyMail.To = Request.Form("email"
MyMail.Subject = "Information Request"
MyMail.Body = "Thank you for visiting the website. The information you filled out on our online form has been received and you will be contacted by one of our representatives shortly."
MyMail.Send

set MyMail=Nothing

Response.Redirect "thankyou.html"
%&gt;</font id='Tahoma'></font id=maroon>


thanks in advance for any help...

Edited by - IckyI on 07 Nov 2006 17:51:47
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 07 Nov 2006 17:56:31
07 Nov 2006 17:56:31 Franck Nowak replied:
augh - sorry for the quick button pushing - i certainly didn't mean to reply to myself - jeesh...
Replied 07 Nov 2006 20:44:19
07 Nov 2006 20:44:19 Franck Nowak replied:
funny how moments after posting in a forum, one quickly finds the answer... my problem was that i was putting returns within the asp string for the body of the message rather than running the html tags together as one string... hope this makes sense... everything is good now...

now onto more complicated schtuff - i have just begun!

Reply to this topic