PDA

View Full Version : CDO.Message.1 error '80040220' The "SendUsing" configuration value is invalid.



Brian
July 15th, 2009, 11:48 AM
The solution to CDO.Message.1 error '80040220' The "SendUsing" configuration value is invalid. is to give the CDO instance the Configuration settings it needs.

The error will look like:

CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.

You probably have something like:

Set objMail = Server.CreateObject("CDO.Message")
objMail.From = argFromAddress
objMail.To = argToAddress
objMail.Subject = argSubject
objMail.htmlBody = argBody
objMail.send
set objMail = Nothing

To add the CDO Configuration that it needs, you need to change the code to be like:

Set objCDOConf = Server.CreateObject ("CDO.Configuration")
' ** SET AND UPDATE FIELDS PROPERTIES **
With objCDOConf
' ** OUT GOING SMTP SERVER **
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP_SERVER_HERE"
' ** SMTP PORT **
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
' ** CDO PORT **
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
' ** TIMEOUT **
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Fields.Update
End With


Set objMail = Server.CreateObject("CDO.Message")

' ** UPDATE THE CDOSYS CONFIGURATION **
Set objMail.Configuration = objCDOConf

objMail.From = argFromAddress
objMail.To = argToAddress
objMail.Subject = argSubject
objMail.htmlBody = argBody
objMail.send

Set objCDOConf = Nothing
set objMail = Nothing

This is a very basic example. You would of course want error checking and handling, etc.

shant1976
November 4th, 2009, 03:34 PM
Try the code posted on:-

http://prabhat.me/2009/11/04/send-e-mail-using-cdo/

namoguy
December 7th, 2010, 04:40 PM
Even after all this time still fixed my issue. Love supporting old apps. Thanks for your post