| Author |
Topic Search Topic Options
|
walrus
Newbie
Joined: 21 April 2004
Location: Australia
Status: Offline
Points: 4
|
Post Options
Thanks(0)
Quote Reply
Topic: cdonts form not formatting Posted: 21 April 2004 at 1:45am |
Hi. I have a simple form that is being processed by the following script. The top three field don't have a line break in the form response email but the rest are fine. Could anyone advise me how to amend the script so the response email reads the fields on different lines please.
<%@ language= "VBscript" %> <% Option Explicit Dim NewMail, Body Set NewMail = Server.CreateObject("CDONTS.NewMail") NewMail.To= "sales@connexus.com" NewMail.From= request.form("Email") NewMail.Subject = "Online Contact Form" NewMail.Body = "Interested in Purchasing a Pre-Owned Mercedes or BMW: " & request.form("Purchasing") & vbcrlf & "Interested in BACK TRADING your car (Car + Cash): " & request.form("Backtrading") & vbcrlf & "Interested in a Trade-In Evaluation: " & request.form("Evaluation") & vbcrlf & "Name: " & request.form("Name") & vbcrlf & "Company: " & request.form("Company") & vbcrlf & "Phone: " & request.form("Phone") & vbcrlf & "Fax: " & request.form("Fax") & vbcrlf & "Comments: " & request.form ("Comments") NewMail.Send Response.Redirect("thanks1.asp") Set NewMail=Nothing %>
Many thanks for any light that can be shed on this.
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 21 April 2004 at 3:54am |
|
What does it look like if you comment out the redirect and do a response.write NewMail.body just before the send?
|
Lead me not into temptation... I know the short cut, follow me.
|
 |
walrus
Newbie
Joined: 21 April 2004
Location: Australia
Status: Offline
Points: 4
|
Post Options
Thanks(0)
Quote Reply
Posted: 21 April 2004 at 4:14am |
Thanks for helping Dpyers. Mmmm....just tried that and got this message on submitting form:
Microsoft VBScript runtime error '800a01b6' Object doesn't support this property or method: 'Body' /contact_post.asp, line 9
Am I supposed to add the line "response.write NewMail.body" just as you have written it? Sorry, no nothing about this stuff.
|
 |
Phat
Senior Member
Joined: 23 February 2003
Status: Offline
Points: 386
|
Post Options
Thanks(0)
Quote Reply
Posted: 21 April 2004 at 5:28am |
|
try
Dim strBody
strBody = "Interested in Purchasing a Pre-Owned Mercedes or BMW: " &
request.form("Purchasing") & vbcrlf & "Interested in BACK
TRADING your car (Car + Cash): " & request.form("Backtrading")
& vbcrlf & "Interested in a Trade-In Evaluation: " &
request.form("Evaluation") & vbcrlf & "Name: " &
request.form("Name") & vbcrlf & "Company: " &
request.form("Company") & vbcrlf & "Phone: " &
request.form("Phone") & vbcrlf & "Fax: " &
request.form("Fax") & vbcrlf & "Comments: " & request.form
("Comments")
Response.Write(strBody)
|
 |
walrus
Newbie
Joined: 21 April 2004
Location: Australia
Status: Offline
Points: 4
|
Post Options
Thanks(0)
Quote Reply
Posted: 21 April 2004 at 5:48am |
|
Thanks for your help Phat. Now....I have no idea what to do with it. Do I change all my NewMail to strBody? Do I add this in and comment out these fields in the original script? Sorry, I know nothing about scripts.
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 21 April 2004 at 2:45pm |
Just recalled that the response.write will show everything on the same line. Try this code...
<%@ language= "VBscript" %> <% Option Explicit Dim objMymail Dim strBody
Set objMymail = Server.CreateObject("CDONTS.NewMail") objMymail.To= "sales@connexus.com" objMymail.From= request.form("Email") objMymail.Subject = "Online Contact Form" objMymail.Subject = "Online Contact Form" strBody = "Interested in Purchasing a Pre-Owned Mercedes or BMW: " & request.form("Purchasing") & vbcrlf & "Interested in BACK TRADING your car (Car + Cash): " & request.form("Backtrading") & vbcrlf & "Interested in a Trade-In Evaluation: " & request.form("Evaluation") & vbcrlf & "Name: " & request.form("Name") & vbcrlf & "Company: " & request.form("Company") & vbcrlf & "Phone: " & request.form("Phone") & vbcrlf & "Fax: " & request.form("Fax") & vbcrlf & "Comments: " & request.form ("Comments") objMymail.Body = strBody objMymail.Send Response.Redirect("thanks1.asp") Set objMymail=Nothing %>
NewMail is a CDO method name, you probably shouldn't use the same name for an object you create. Changed it to objMymail.
If the email doesn't display appropriate line breaks:
- Try replacing vbCRFL with chr(13) & chr(10)
- If it still doesn't work, check your form and any java validation script (you may want to post the code here).
- Try looking at the email with a different email client.
Edited by dpyers
|
Lead me not into temptation... I know the short cut, follow me.
|
 |
walrus
Newbie
Joined: 21 April 2004
Location: Australia
Status: Offline
Points: 4
|
Post Options
Thanks(0)
Quote Reply
Posted: 21 April 2004 at 8:06pm |
Thanks Dpyers for going to so much trouble. I have continued testing and have just noticed a message in Outlook saying that extra line breaks were removed and to click to restore. All looks fine once restored but don't know if this is an Outlook default or what??? Thanks again.
Cheers Lance
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 21 April 2004 at 8:15pm |
Foir others who may be using the same email client, you may want to try changing the Carriage-Return plus Line-Feed to just a Line-Feed by replacing vbCRLF with chr(10) - the ansi cde for a linefeed. e.g.
"Line 1" & chr(10) & "Line 2"
|
Lead me not into temptation... I know the short cut, follow me.
|
 |