Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 26th, 2004, 10:47 AM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default The most basic question about forms

Please forgive my lack of knowledge.  I have used asp / CDONTS to send the results of a pretty simple form to me.  No fancy formatting required.

It has suddenly begun to send blank emails after displaying an error

error '80040108'
/geta.asp, line 23

this is the line:

ObjMail.Body = "Instructions" & vbtab & instructions & vbcrlf&_

I haven't the slightest idea what can be wrong with the line but someone suggested that I need to convert to CDO.

Is there anyplace that can tell me what to do with my simple code or where to get other code to do this?

I will post the code if appropriate but didn't want to overstep etiquette.

Thanks
 
Old February 26th, 2004, 11:15 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Are you by any chance sending e-mails inside a loop and reusing the same CDONTS object?

I think I have see something similar to this. Moving the CreateObject to inside the loop (thereby creating a fresh instance every time) seemed to do the trick.

If that doesn't help, can you post the code?

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 26th, 2004, 04:12 PM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The form validates perfectly. Here is the FORM description:
<FORM ACTION=geta.asp method="post" name=orderform>

Here is geta.asp. The fields are perfectly correct and I've checked them over and over.

<%
Dim instructions,track,bladder,yourname,address,city,s tate,zip,country,phone,creditcard,expdate,email
instructions = Request.Form("instructions")
track = Request.Form("track")
bladder = Request.Form("bladder")
yourname = Request.Form("yourname")
address = Request.Form("address")
city = Request.Form("city")
state = Request.Form("state")
zip = Request.Form("zip")
country = Request.Form("country")
phone = Request.Form("phone")
creditcard = Request.Form("creditcard")
expdate = Request.Form("expdate")
email = Request.Form("email")
Dim kits
kits = Request.Form("kits")
Dim ObjMail
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.To = "[email protected]"
ObjMail.From = "[email protected]"
ObjMail.Subject = "Dinghy Dogs order"
ObjMail.Body = "Instructions" & vbtab & instructions & vbcrlf&_
"Track" & vbtab & track & vbcrlf&_
"Bladder" & vbtab & bladder & vbcrlf&_
"Name" & vbtab & yourname & vbcrlf&_
"Address" & vbtab & address & vbcrlf&_
"City" & vbtab & city & vbcrlf&_
"State" & vbtab & state & vbcrlf&_
"Zip" & vbtab & zip & vbcrlf&_
"Country" & vbtab & country & vbcrlf&_
"Phone" & vbtab & phone & vbcrlf&_
"Card#" & vbtab & credit & vbcrlf&_
"Exp.Date" & vbtab & expdate & vbcrlf&_
"Email" & vbtab & email & vbcrlf&_
"Ordered" & vbtab & kits & vbcrlf&_
ObjMail.Send
Set ObjMail = Nothing
Response.Write"Thank You For Your Order"
%>


can you see any explanation?

 
Old February 26th, 2004, 05:26 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, I can see a problem. You're appending the result of the Send instruction to the Body property:

"Ordered" & vbtab & kits & vbcrlf&_
ObjMail.Send

The underscore is used as a line continuation character. So, in effect this is what this line says:

"Ordered" & vbtab & kits & vbcrlf & ObjMail.Send

Apart from being nonsense, I think you're creating some kind of circular reference. You try to append the result of the Send method to the body of the message you're trying to send ;)

Try this:

"Ordered" & vbTab & kits & vbCrLf
ObjMail.Send()

If you get used to adding spaces to your code as much as possible, you'll spot these kind of errors earlier. It won't make a difference how the code runs, but it is so much easier to look at.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 26th, 2004, 06:22 PM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So the underscores should be replaced by spaces and each element placed on a separate line?

 
Old February 26th, 2004, 06:29 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

No, he just means put spaces between your operators:

"Zip" & vbtab & zip & vbcrlf & _
"Country" & vbtab & country & vbcrlf & _
"Phone" & vbtab & phone & vbcrlf & _

You still need the underscore for code line continuation.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old February 26th, 2004, 06:32 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, yes, except for the very last one, right before the line with the Send method.

Cheers

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 1st, 2005, 01:03 PM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gsirianni1205
Default

Quote:
quote:Originally posted by Imar
 Are you by any chance sending e-mails inside a loop and reusing the same CDONTS object?

I think I have see something similar to this. Moving the CreateObject to inside the loop (thereby creating a fresh instance every time) seemed to do the trick.

If that doesn't help, can you post the code?

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 1st, 2005, 01:04 PM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gsirianni1205
Default

I just wanted to say thanks. I had the same problem and that solved the issue. Stupid me. I had the same problem in ASP.net a while back and it was real simple to solve then. I guess creating appz in an IDE can keep things more in check.



Quote:
quote:Originally posted by Imar
 Are you by any chance sending e-mails inside a loop and reusing the same CDONTS object?

I think I have see something similar to this. Moving the CreateObject to inside the loop (thereby creating a fresh instance every time) seemed to do the trick.

If that doesn't help, can you post the code?

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 2nd, 2005, 08:54 AM
Authorized User
 
Join Date: Sep 2004
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nashnash
Default

"Instructions" & vbtab & instructions & vbcrlf &_
               "Track" & vbtab & track & vbcrlf&_
                "Bladder" & vbtab & bladder & vbcrlf&_
                "Name" & vbtab & yourname & vbcrlf&_
                "Address" & vbtab & address & vbcrlf&_
                "City" & vbtab & city & vbcrlf&_
                "State" & vbtab & state & vbcrlf&_
                "Zip" & vbtab & zip & vbcrlf&_
                "Country" & vbtab & country & vbcrlf&_
                "Phone" & vbtab & phone & vbcrlf&_
                "Card#" & vbtab & credit & vbcrlf&_
                "Exp.Date" & vbtab & expdate & vbcrlf&_
                "Email" & vbtab & email & vbcrlf&_
                "Ordered" & vbtab & kits & vbcrlf

Just replace this with yours and this will work fine...







Similar Threads
Thread Thread Starter Forum Replies Last Post
Very Basic Question on Spacing with CSS guynorton CSS Cascading Style Sheets 4 December 14th, 2006 04:33 PM
Please HELP Very Basic Question jkoe578 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 November 18th, 2006 10:06 AM
xslt basic question kgoldvas XSLT 2 January 25th, 2006 02:48 PM
basic xslt Question abhishek verma XSLT 4 January 24th, 2006 05:35 AM
basic question but..... Adam H-W Javascript How-To 2 February 10th, 2004 01:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.