Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 August 16th, 2004, 01:40 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please Help: CDONTs - Form to Email problem

I am wanting to put the values from a form into an email. I
ve done this before and everything worked fine! So, I've copied the previous form and its related get.asp (which gives the instructions to write to an e-mail, using CDONTS) and tweaked the form fields to accomodate this new version. BUT I keep getting an error in the line which calls the body of the email.

And when looking into this file:
F:\Inetpub\mailroot\Badmail

I get the the following text file:

X-Receiver: [email protected]
X-Receiver: [email protected]
To: <[email protected]>
Cc: <[email protected]>
Subject: COMMERCIAL PROPOSAL Request
Date: Mon, 16 Aug 2004 13:42:09 -0400
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441

It clearly shows that the file stops interpreting exactly at:
ObjMail.Body =

Here's the contents of the get.asp:
************************************************** **
Dim ObjMail
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.To = "[email protected]"
ObjMail.Cc = "[email protected]"

'ObjMail.From = t1

ObjMail.Subject = "COMMERCIAL PROPOSAL Request"
ObjMail.Body = t1name & t1 & vbcrlf&_
t1name & t1 & vbcrlf&_
t2name & t2 & vbcrlf&_
t3name & t3 & vbcrlf&_
t4name & t4 & vbcrlf&_
t5name & t5 & vbcrlf&_
t6name & t6 & vbcrlf&_
t7name & t7 & vbcrlf&_
t8name & t8 & vbcrlf&_
t9name & t9 & vbcrlf&_
t10name & t10 & vbcrlf&_
t11name & t11 & vbcrlf&_
l1name & l1 & vbcrlf&_
l2name & l2 & vbcrlf&_
l3name & l3 & vbcrlf&_
l4name & l4 & vbcrlf&_

ObjMail.Send
Set ObjMail = Nothing
*********************************************

Of course all my fields have been assigned a variable, in this asp as well.

Please help?
Thanks all,
Nancy
 
Old August 16th, 2004, 01:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Nancy,

Comment out the last 2 lines of your posted code and do a Response.write before those last 2 lines as given below.
Code:
Response.write t1name & t1 & vbcrlf&_
t1name & t1 & vbcrlf&_
t2name & t2 & vbcrlf&_
t3name & t3 & vbcrlf&_
t4name & t4 & vbcrlf&_
t5name & t5 & vbcrlf&_
t6name & t6 & vbcrlf&_
t7name & t7 & vbcrlf&_
t8name & t8 & vbcrlf&_
t9name & t9 & vbcrlf&_
t10name & t10 & vbcrlf&_
t11name & t11 & vbcrlf&_
l1name & l1 & vbcrlf&_
l2name & l2 & vbcrlf&_
l3name & l3 & vbcrlf&_
l4name & l4 & vbcrlf&_

'ObjMail.Send
'Set ObjMail = Nothing
Still this would result in error, coz' the error is Marked in Red above. Remove that, thing should be fine then. I can't see anything other than that.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 16th, 2004, 02:52 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Happygv,
The response.write wasn't exactly what I was looking for, coz I didn't want my form fields to be written to the browser, but rather to an email.

The error I had at the bottom of my page (the one you had highlighted in red) was what was causing the problem.

I know all the code in get.asp was considered because I did get the response.write ("Thank you"), once I clicked submit. However I never received the email thread with all the data???

I sent this to myself for testing purposes.
Would you happen to know why I don't receive the data?

Thanks again for your prompt response.

Nancy
 
Old August 16th, 2004, 03:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Nancy,

Though I knew response.write wasn't what exactly you wanted, I just wanted to let you know how to debug that using response.write after removing the &_ from there, to see if all variables had its data in it as the next step. Also you didn't say what error you were getting in that case.

I am not sure why you were not receiving the mail. One I could think of, is to check if SMTP is configured and up, running on the webserver.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 16th, 2004, 03:12 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nancy,

Did you try this code on the same Email server as the one that successfully ran the previous code? Can you give us an idea of what the body would look like? Have you tried a simple email like:

Dim ObjMail
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.To = "[email protected]"
ObjMail.Cc = "[email protected]"

'ObjMail.From = t1

ObjMail.Subject = "COMMERCIAL PROPOSAL Request"
ObjMail.Body = "Hello World"

ObjMail.Send
Set ObjMail = Nothing
 
Old August 16th, 2004, 03:17 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,
Apparently the webserver is already set up. Is this a per folder requirement?
Can you think of any other reason this might not be working?

Thanks again for all your support,
Appreciatively,
Nancy
 
Old August 16th, 2004, 03:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Does that mean the SMTP service is running?

_________________________
- Vijay G
Strive for Perfection
 
Old August 16th, 2004, 03:21 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yehuda,
Thank you for your help. I did try your code, and am still NOT receiving the email.
As per your request here is the the code for the ObjBody:

********************************

Dim ObjMail
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.To = "[email protected]"
ObjMail.Cc = "[email protected]"

ObjMail.From = t1

ObjMail.Subject = "COMMERCIAL PROPOSAL Request"
ObjMail.Body = t1name & t1 & vbcrlf&_
t1name & t1 & vbcrlf&_
t2name & t2 & vbcrlf&_
t3name & t3 & vbcrlf&_
t4name & t4 & vbcrlf&_
t5name & t5 & vbcrlf&_
t6name & t6 & vbcrlf&_
t7name & t7 & vbcrlf&_
t8name & t8 & vbcrlf&_
t9name & t9 & vbcrlf&_
t10name & t10 & vbcrlf&_
t11name & t11 & vbcrlf&_
l1name & l1 & vbcrlf&_
l2name & l2 & vbcrlf&_
l3name & l3 & vbcrlf&_
l4name & l4 & vbcrlf

ObjMail.Send
Set ObjMail = Nothing
'HERE you make a choice. You can redirect the user to any page in your site
'Response.Redirect("ProposalSubmitted.htm")
'Or just say thanks. Delete the line you dont want. Either above or below
Response.Write"Thank You"
%>

********************************
Thanks again
 
Old August 16th, 2004, 03:28 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What does all those variable tags contain? Can you give us a sample of what the email you are sending should look like? Have you ever successfully sent from the web server? Can you have the Admin check if there are any failed or unsent emails in the queue?

Yehuda
 
Old August 16th, 2004, 03:37 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Nancy,

Besides checking on what yehuda suggested, Open up Services console of your webserver and check "Simple Mail Transport Protocol (SMTP)" shows up STARTED as its status. If not, you cannot send mails without starting that service on your server that runs IIS. If you have no access to service console of your webserver, you can do a
Code:
telnet webserver_name 25
from command prompt and see if that connects. That means SMTP is up and we got to think of something else. But if that doesn't connect, then you got to get that service up.

Hope that explains.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
EMail (CDONTS) File Attachment is blank Jorge Classic ASP Components 1 March 11th, 2004 03:54 PM
Email using Frontpage and CDONTS levinho Classic ASP Databases 0 November 17th, 2003 04:20 PM





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