 |
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 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
|
|
|

February 19th, 2007, 04:12 PM
|
Registered User
|
|
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|

February 19th, 2007, 08:59 PM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
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
|

February 20th, 2007, 10:07 AM
|
Registered User
|
|
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

February 20th, 2007, 10:15 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
|

February 20th, 2007, 10:31 AM
|
Registered User
|
|
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

February 20th, 2007, 10:37 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
|

February 20th, 2007, 10:41 AM
|
Registered User
|
|
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

February 20th, 2007, 10:48 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
|

February 20th, 2007, 11:43 AM
|
Registered User
|
|
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

February 20th, 2007, 11:58 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
|
|
 |