Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 19th, 2007, 04:12 PM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default CDO Email error

I'm trying to send an webpage via email to a user who fills out a form on my website. Problem is, some days it works, some days it doesn't, despite me not changing the code. Some days, it will work in the morning, not in the afternoon.

When it works, the email gets sent as instructed. When it doesn't work, I get :

CDO.Message.1 error '80040218'
Unknown Error
/functions.asp, line 98

which corresponds to the webpage on the server (the webpage I am trying to send) cannot be found.

The code I am using, which I have seen posted as the proper code on several different tutorials is:

objMessage.Subject = "Password Request"
objMessage.From = "mywebsite@...."
objMessage.To = myEmail
objMessage.CreateMHTMLBody "http://www.myapplication.com/ForgottenPasswordEmail.asp?Password=" & Password
objMessage.Send

When I put in displayed to see where its crashing, its the 'CreateMHTMLBODY' line that isn't working. But as I've said, other days, it works just fine.

So is there possibly something on my server, a web service or something of the like, that is going down, preventing my email???

Nothing is going to the BADMAIL folder; and other CDO Emails, those just sending text, are working fine, so the CDO process seems to be working fine.

Any thoughts?

Reply With Quote
  #2 (permalink)  
Old February 19th, 2007, 08:59 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Where in your mail page are you calling the problematic function?
What is the values(s) you are passing into this function?
Show us the function and point out line 98?

Are you aware of the CDOSYS mail method? This is the reccomended method and the one which will give you best results

Anyhow - Make sure you get the URL right. CDO.Message does not understand relative URL formats; it has to be the FULL URL. this article should rrsolve your problem:
http://classicasp.aspfaq.com/email/w...0d-errors.html


Wind is your friend
Matt
Reply With Quote
  #3 (permalink)  
Old February 20th, 2007, 10:07 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mat41
 Where in your mail page are you calling the problematic function?
What is the values(s) you are passing into this function?
Show us the function and point out line 98?

Are you aware of the CDOSYS mail method? This is the reccomended method and the one which will give you best results

Anyhow - Make sure you get the URL right. CDO.Message does not understand relative URL formats; it has to be the FULL URL. this article should rrsolve your problem:
http://classicasp.aspfaq.com/email/w...0d-errors.html


Wind is your friend
Matt

The full URL is listed. I had previously seen that article, and the error code corresponds with that the server is found, but not the page on the server. But as I said, sometimes it works, sometimes it doesn't. So why is the same page found sometimes, but not other times?

I don't believe it is a problem with the code, since it works sometimes with the same data entry, but something environmental on the server.

Line 98 is

objMessage.CreateMHTMLBody "http://www.myapplication.com/ForgottenPasswordEmail.asp?Password=" & Password


Reply With Quote
  #4 (permalink)  
Old February 20th, 2007, 10:15 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Are you doing any error tracking in your code? If not, I would set some up so that you can see what the URL is when the method bombs because, i suspect, it has to do with the parameter Password in the query string.

This would tend to make sense in your situation where "Sometimes it works, sometimes it doesnt." The URL never changes, just your parameter, so that may be what is causing the problem.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
Reply With Quote
  #5 (permalink)  
Old February 20th, 2007, 10:31 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried removing the parameter and hardcoding the password into the code and that didn't work either. The passed parameters are always the same. There is only one User ID in the system right now. The user (me right now) types in the last name and email address, a database lookup occurs and grabs the password. I can see that it is indeed getting to the Database and getting the proper password. (If there was an incorrect name and email, it doesn't get to this point in the code; an 'unable to find user id, plaese try again' occurs like it should

But when it tries the CreateMHTML line, it is getting an error.

I tried changing the code to the below code, but it dies at the same place, the CreateMHTML line.

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
.Update
End With
With iMsg
Set .Configuration = iConf
.To = myEmail
.From = "PasswordRequest@myapplication.com"
.Subject = "Your Password"
.CreateMHTMLBody "http://www.myapplication.com/ForgottenPasswordEmail.asp?Password=" & Password
.Send
End With
Set Flds = Nothing
Set iMsg = Nothing
Set iConf = Nothing
Reply With Quote
  #6 (permalink)  
Old February 20th, 2007, 10:37 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What happens if you remove the parameter all together so just :

"http://www.myapplication.com/ForgottenPasswordEmail.asp

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
Reply With Quote
  #7 (permalink)  
Old February 20th, 2007, 10:41 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dparsons
 What happens if you remove the parameter all together so just :

"http://www.myapplication.com/ForgottenPasswordEmail.asp
LOL, yeah, I tried that too. Same error.

Reply With Quote
  #8 (permalink)  
Old February 20th, 2007, 10:48 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Then, logically, your server is timing out when you make this call which is then resulting in your error.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
Reply With Quote
  #9 (permalink)  
Old February 20th, 2007, 11:43 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dparsons
 Then, logically, your server is timing out when you make this call which is then resulting in your error.
I'm not sure I see that jump in logic.

Reply With Quote
  #10 (permalink)  
Old February 20th, 2007, 11:58 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Here is the breakdown.

If you eliminate all variables from the equation: e.g. the query string value, and you know that the page exists and your call is still failing you have to go back to the original error message which means the page doesn't exist. Or rather that the call can not find the page specified. Since you know that the page does infact exist, one can reasonably deduce that the server is, or could be, timing out when calls are made.



================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CDO email BananaJim Classic ASP Professional 6 January 27th, 2007 08:04 PM
CDO external email error in ASP Robert02 Classic ASP Professional 0 July 5th, 2006 04:28 PM
error sending email with attachment using CDO archanahs Classic ASP Professional 1 May 25th, 2006 08:16 AM
Email Problem - CDO SYS Error itHighway Classic ASP Basics 1 August 25th, 2005 05:14 AM



All times are GMT -4. The time now is 02:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.