The error CDO.Message.1 (0x80040220) -The "SendUsing" configuration value is invalid is back again on IIS 7.5 and the reasons are also the same! inadequate permissions on the IIS Metabase due to which CDOSYS is unable to read the location of the Pickup Directory from the IIS Metabase.
What has changed? The default Application Pool Identity in IIS 7.5 changed from NetworkService to AppPoolIdentity. For every Application Pool you create, the IIS Admin Process (WAS) will create a virtual account with the name of the new Application Pool and run the Application Pool's worker processes under this account. It is this account that is not able to read the location of the Pickup Directory from the IIS Metabase. You can read more about AppPoolIdentity here.
What are the available options to resolve the error? AFAIK there are 3 ways to resolve the error:
1) This is the easiest one, configure the application pool identity under which the site is running to NetworkService instead of AppPoolIdentity. From what I have seen the NetworkService account has “Special Permissions” on the /LM/SmtpSvc/ and /LM/SmtpSvc/1/ nodes in the IIS Metabase.
2) In case you do not want to change any permissions and are ok with code changes, then you can specify the smtpserverpickupdirectory and set its value to the path of pickup directory. Below is how we do it on VB Script.
'Send using the Pickup directory on the IIS server.
Const cdoSendUsingPickup = 1
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPickup
'The path may differ in your environment
' Build HTML for message body.
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"
Set .Configuration = iConf
.To = "email@example.com"
.From = "firstname.lastname@example.org"
.Subject = "This is a test CDOSYS message (Sent via Pickup)"
.HTMLBody = strHTML
' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
MsgBox "Mail Sent!"