Making IIS send mail on XP
As a reminder for myself, and in case anyone happens to find it useful: if you run into problems making IIS send mail with CDOSYS from within a .asp file (VBScript) like I did today - this may help:
First, put this at the very top of your script (before the language declaration, etc)
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->Next, use code like this to send the mail:
Dim objMessage, objConfig
Set objMessage = Server.CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.Configuration")
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer) = "your.mail.server.name.or.ip" objConfig.Fields(cdoSMTPServerPort) = 25
objConfig.Fields(cdoSMTPAuthenticate) = cdoBasic ' If you need SMTP auth, use the next 2 lines
' objConfig.Fields(cdoSendUserName) = "username"
' objConfig.Fields(cdoSendPassword) = "password"
objConfig.Fields.Update
Set objMessage.Configuration = objConfig
objMessage.Subject = "Your message subject"
objMessage.From = "Your name <your @email>"
objMessage.To = "Recipient name <recipient @email>"
objMessage.TextBody = "Your message here"
objMessage.Send
Set objMessage = Nothing
Set objConfig = NothingThere ... easy when you know how. I have to admit that I find PHP a much more friendly environment to develop web apps with. Even allowing for the years of experience I've got with PHP compared to my relatively rare need to work with IIS, the whole process of setting up, learning and debugging PHP was just so much easier. Still, horses for courses I suppose.
For the search engines, the error I was receiving was:
Error Type: CDO.Message.1 (0x80040220)
The "SendUsing" configuration value is invalid.