Bypass Outlook prompts with VBA

jl39775

Registered User.
Local time
Today, 14:48
Joined
Dec 12, 2001
Messages
43
I am sending mail and attachments using Access 2002 and Outlook 2002. When my code send the mail Outlook gives me two prompt for each Recipients. I attached a word file with the prompt images. does anyone know how I can bypass the prompts. This applications is a batch mail application and sends emails to many people and I don't want to hit yes for every prompt.

Thanks,

James
 

Attachments

  • message.jpg
    message.jpg
    31.3 KB · Views: 255
Drevlin,

Thank for the info. I will download the com object and play with it. We are also looking into other options. I will keep everyone posted with the results.

James
 
After downloading the COM object from the link that Drevlin provided above I did the following to send batch emails w/attachment without the Outlook 2002 security alerts. Keep in mind that I modified the code below. It will not send batch emails just a single email. One problem I ran into was that my email would be stored in the draft box and would stay there until I press the Send/Recieve button. To get around this problem make sure your Outlook's message store is not set as POP3/SMTP transport and a PST file. Plus add the last two lines below to send the email.

I hope this will help others developer from being as frustrated as I was when I spent a whole day figuring out how to get around my email problems. Email was so easy to code in the past but Microsoft did not think their solution to viruses attacking Outlook well. It's so much harder for developers to write code that sends batch email until the Redemption COM object below came along.

James

'Declare & set object & variables
Dim objOutlook As Outlook.Application
Dim NameSpace As NameSpace
Dim SafeItem, oItem, Utils

'Used to sent email to recipient not Draft box
Set objOutlook = CreateObject("Outlook.Appclication")

'Used to sent email to recipient not Draft box
Set NameSpace = objOutlook.GetNamespace("MAPI")
NameSpace.Logon

'set object that bypasses Outlook 2002 (a.k.a Outlook XP) security
Set SafeItem = CreateObject("Redemption.SafeContactItem") 'Create an instance of Redemption.SafeContactItem

Set oItem = objOutlook.CreateItem(0)
SafeItem.Item = oItem 'set Item property of a SafeContact to an Outlook contact item

'adds to email address, subject, body .... and sends email
With SafeItem

Set objOutlookRecip = .Recipients.Add("Someone@someplace.com)
objOutlookRecip.Type = olTo
.Subject = "Subject here"
.Importance = olImportanceHigh
.Body = "Body text here"

.Send
Set Utils = CreateObject("Redemption.MAPIUtils")
Utils.DeliverNow
 

Users who are viewing this thread

Back
Top Bottom