P
Peter Hibbs
With Outlook 2003 and Access 2003 I am using the following code to
send emails from an Access database using Outlook Redemption.
Dim SafeItem As Object, oItem As Object
Dim objApp As Object, NS As Object
'Create instance of Outlook Application
Set objApp = CreateObject("Outlook.Application")
Set NS = objApp.GetNamespace("MAPI")
NS.Logon
'Create an instance of Redemption.SafeMailItem
Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = objApp.CreateItem(0)
SafeItem.Item = oItem
SafeItem.To = "email address here"
SafeItem.Subject = "email subject text"
SafeItem.BodyFormat = 2
SafeItem.HTMLBody = "email body text"
'Send email and close
SafeItem.Send
Set SafeItem = Nothing
Set oItem = Nothing
Set NS = Nothing
Set objApp = Nothing
I notice that the email ONLY gets sent if Outlook is actually running.
Is this correct and, if so, is there any way to send an email while
Outlook is NOT loaded?
Peter Hibbs.
send emails from an Access database using Outlook Redemption.
Dim SafeItem As Object, oItem As Object
Dim objApp As Object, NS As Object
'Create instance of Outlook Application
Set objApp = CreateObject("Outlook.Application")
Set NS = objApp.GetNamespace("MAPI")
NS.Logon
'Create an instance of Redemption.SafeMailItem
Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = objApp.CreateItem(0)
SafeItem.Item = oItem
SafeItem.To = "email address here"
SafeItem.Subject = "email subject text"
SafeItem.BodyFormat = 2
SafeItem.HTMLBody = "email body text"
'Send email and close
SafeItem.Send
Set SafeItem = Nothing
Set oItem = Nothing
Set NS = Nothing
Set objApp = Nothing
I notice that the email ONLY gets sent if Outlook is actually running.
Is this correct and, if so, is there any way to send an email while
Outlook is NOT loaded?
Peter Hibbs.