How can I write a script to send an e-mail from a form web page under Windows 2003 Hosting ?
A. Our Windows hosting is built with Windows 2003 and above. Therefore, the older CDONTS component is not available anymore as it was found to be insecure. The new component is called CDO and there are many code samples on the Internet to see how you can use it. Below is a code sample tested with out hosting system which any Windows Hosting customer can use:
Set iMsg = CreateObject("CDO.Message") 'calls CDO message COM object
Set iConf = CreateObject("CDO.Configuration") 'calls CDO configuration COM object
Set Flds = iConf.Fields
Flds( "http://schemas.microsoft.com/cdo/configuration/sendusing") = 1 'tells cdo we're using the local smtp service
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup" 'verify that this path is correct
Flds.Update 'updates CDO's configuration database
Set iMsg.Configuration = iConf 'sets the configuration for the message
iMsg.To = " firstname.lastname@example.org " 'could also be " email@example.com "
iMsg.From = " firstname.lastname@example.org " 'must be " email@example.com "
iMsg.Subject = "Test subject"
iMsg.HTMLBody = "Some email text"
iMsg.Send 'commands CDO to send the message