?
Solved

CDO Email Authentication Problem

Posted on 2009-02-16
4
Medium Priority
?
1,136 Views
Last Modified: 2012-08-13
I'm trying to use the following script but it produces this error: Error 8004020f, line 24. This appears to mean it's not authenticating. Hosting tech support isn't much help. If someone has a similar script that works, I'll gladly give it a try. I just want to send a simple acknowledgment message when someone completes a form. Thanks, Gary


Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Authenticate if necessary
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

'Outgoing SMTP server configuration
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.domain.com"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoSendUsingPort
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "mail@domain.com" 'This has to be valid on the selected SMTP server
strSubject = "Email test"
strHTML = "This is a test"
objCDOSYSMail.To = "email@domain.com"
objCDOSYSMail.Subject = strSubject
objCDOSYSMail.HTMLBody = strHTML
objCDOSYSMail.Send

0
Comment
Question by:WebStudioWest
  • 2
4 Comments
 
LVL 14

Assisted Solution

by:yehudaha
yehudaha earned 800 total points
ID: 23656882
0
 
LVL 14

Assisted Solution

by:yehudaha
yehudaha earned 800 total points
ID: 23656943
maybe smtp relaying permissions problem. Does your smtp server
allow relaying from your IIS server ip ?
0
 
LVL 16

Assisted Solution

by:Wadski
Wadski earned 400 total points
ID: 23659052
I presume you are usinfg the hosting companies SMTP - you will need to Authorise with the server or potentially make sure the from: address is a domain they host.
0
 

Accepted Solution

by:
WebStudioWest earned 0 total points
ID: 23660447
My host told me to add the following line:

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = "cdoBasic"

Then I received an error about Fields.Update so I deleted that line and it works. Here's the script:

Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Authenticate if necessary
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

'Outgoing SMTP server configuration
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = "cdoBasic"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.domain.com"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoSendUsingPort
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "mail@domain.com" 'This has to be valid email address on the selected SMTP server
strSubject = "Email test"
strHTML = "This is a test"
objCDOSYSMail.To = "name@email.com"
objCDOSYSMail.Subject = strSubject
objCDOSYSMail.HTMLBody = strHTML
objCDOSYSMail.Send


Thanks for all your help!

Gary

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question