CDOSYS problem
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=27881
Printed Date: 29 March 2026 at 4:40am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: CDOSYS problem
Posted By: k00k
Subject: CDOSYS problem
Date Posted: 27 September 2009 at 1:07pm
I am attempting to send an e-mail from within an ASP script using the following code:
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSConfig = Server.CreateObject("CDO.Configuration")
objCDOSYSConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objCDOSYSConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "noreply@somewhere.co.uk"
objCDOSYSConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "thepassword"
objCDOSYSConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.mailserver.co.uk"
objCDOSYSConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSConfig.Fields.Update
Set objCDOSYSMail.Configuration = objCDOSYSConfig
objCDOSYSMail.From = strFromEmailName & " <" & strFromEmailAddress & ">"
objCDOSYSMail.To = strRecipientName & " <" & strRecipientEmailAddress & ">"
objCDOSYSMailSubject = strSubject
objCDOSYSMail.TextBody = strEmailBodyMessage
objCDOSYSMail.Send
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
|
The mail server, username and password (replaced above with generic values for security) have been verified as correct. I can successfully log into the webmail application using these credentials and send/receive e-mail.
The variables contain (strFromEmailName, strFromEmailAddress, strRecipientName, strRecipientEmailAddress) contain valid data and are active e-mail addresses.
Upon executing the script, I received the incredibly unhelpful:
error '8004020f'
/development/includes/email.asp, line 84
|
Line 84 being:
Am I missing something obvious? Has anyone had similar problems?
I am WW web hosting customer on nemesis.websitelive.net.
|
Replies:
Posted By: WebWiz-Bruce
Date Posted: 28 September 2009 at 9:56am
The code looks correct to me, however you can get this error if the mail server is rejecting the email.
It could be that the mail server address is wrong or the authentication is incorrect.
The mail server address of mail.mailserver.co.uk is not a valid address for our mail servers. If you are testing the application on your own server then this may also be the problem, try uploading it to our network.
------------- https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting
|
Posted By: k00k
Date Posted: 28 September 2009 at 10:03am
I know about the mail server address being "incorrect". I chose not to post the real domain on a public form for obvious reasons :)
Anyway, I managed to resolve the problem. It simply boiled down to an incorrect password. I wish M$ provided slightly more helpful error messages for CDOSYS and I probably would have picked up on the error a bit quicker.
Thanks for the reply!
|
Posted By: 123Simples
Date Posted: 15 November 2009 at 4:11pm
Thanks k00k because I was having issues similar to this, and this post really helped me out
------------- http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design
|
|