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:
HTML Code:
CDO.Message.1 error '80040220'
The "SendUsing" configuration value is invalid.
You probably have something like:
Code:
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:
Code:
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.