[AccessD] Automating email

David Emerson newsgrps at dalyn.co.nz
Mon Feb 19 18:31:30 CST 2007


Group,

I have the following code to create an email message:

Public Function basSendEmail()

     Dim outApp As Outlook.Application, outMsg As MailItem

     Set outApp = CreateObject("Outlook.Application")
     Set outMsg = outApp.CreateItem(olMailItem)

     With outMsg
         .To = "newsgrps at dalyn.co.nz"
         .Subject = "Test egas email"
         .Body = "Test message"
         .Send
     End With

     Set outApp = Nothing
     Set outMsg = Nothing

End Function

This works fine but only puts the message into my Outlook outbox - it 
doesn't send it.  This may be because although I have outlook 
installed I do not use it (and it has not been set up).

However, my clients use outlook.  Will the above code automatically 
send out emails?

Another question - My client would prefer not to have copies in their 
outbox of the email being sent out (ultimately it will be to email 
out accounts and they don't want thousands of emails generated each 
month).  Is there a way for the messages not to appear in outlook?





More information about the AccessD mailing list