Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - cdonts form not formatting
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

cdonts form not formatting

 Post Reply Post Reply
Author
walrus View Drop Down
Newbie
Newbie
Avatar

Joined: 21 April 2004
Location: Australia
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote walrus Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
walrus View Drop Down
Newbie
Newbie
Avatar

Joined: 21 April 2004
Location: Australia
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote walrus Quote  Post ReplyReply Direct Link To This Post 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.

 

Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
walrus View Drop Down
Newbie
Newbie
Avatar

Joined: 21 April 2004
Location: Australia
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote walrus Quote  Post ReplyReply Direct Link To This Post 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. 
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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:

  1. Try replacing vbCRFL with chr(13) & chr(10)
  2. If it still doesn't work, check your form and any java validation script (you may want to post the code here).
  3. 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.
Back to Top
walrus View Drop Down
Newbie
Newbie
Avatar

Joined: 21 April 2004
Location: Australia
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote walrus Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.