loMessage = CREATEOBJECT("CDO.Message")If you've got FrontPage Server Extensions installed as well, though, you'll run into a hitch -- you'll most likely get an error message when you call loMessage.Send()
OLE IDispatch exception code 0 from CDO.Message.1: The "SendUsing" configuration value is invalid.This is because FPSE mucks things up sufficiently that you have to set the mail message's Configuration object, like so:
#DEFINE cdoSendUsingPickup 1 #DEFINE cdoSendUsingPort 2 WITH CREATEOBJECT("CDO.Message") .Configuration = SMTPConfig(cdoSendUsingPickup) .TextBody = "This is a testy message..." .To = "You <you@yourplace.com>" .From = "Me <me@myplace.com>" .Subject = "Test Message" .Send() ENDWITH FUNCTION SMTPConfig(tiSendMethod, tcSMTPServer) LOCAL loSMTPConfig LOCAL lcSMTPServer LOCAL lcConfigURL lcSMTPServer = IIF(EMPTY(tcSMTPServer), "localhost", tcSMTPServer) lcConfigURL = "http://schemas.microsoft.com/cdo/configuration/" loSMTPConfig = CREATEOBJECT("CDO.Configuration") WITH loSMTPConfig.Fields IF tiSendMethod = cdoSendUsingPickup * Send using the Pickup directory .Item(lcConfigURL + "smtpserverpickupdirectory") = ; "C:\InetPub\MailRoot\" ELSE * Send using the SMTP port .Item(lcConfigURL + "smtpserverport") = 25 .Item(lcConfigURL + "smtpserver") = lcSMTPServer ENDIF .Item(lcConfigURL + "sendusing") = tiSendMethod .Update() ENDWITH * Return the configuration RETURN loSMTPConfig ENDFUNCHTH,