I'm trying to automate emailing a report on a scheduled basis. I was intending to use Windows Task Scheduler with the /X switch in Access to fire up a macor which runs the query and sends the report as an excel file using the sendobject command.
The trouble is I have Office XP and Outlook 2002 has a security feature that requires user input before it will send an email.
Try using the code below. It will send an HTML email thru SMTP. Outlook doesn't even see it, however your Exchange server (if you have one) might.
Const cdoSendUsingPort = 2
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' Set the CDOSYS configuration fields to use port 25 on the SMTP server.
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp-mail-server-here"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
3. use another SMTP API for sending emails
most of them are not free
4. you can use Windows 2000 Server CDONT - called CDO for Windows 2000 (it is different CDO than CDO above!!!)
it uses Windows SMTP Server and it is used mostly for scripting and in ASP pages for sending emails....