Outlook NewMail event routine requires interactive OK ??

M

MarkB

I am trying to filter some junk email. I have been able to achieve some
success with rules, but the spammers are no dummies; they use tactics hard
to address with rules.

So I have written a small macro to process email on arrival (in the NewMail
event) - mostly filtering out junk mail based on the TO address, subject and
body text. But every time it runs, Outlook pops up with:

A program is trying to access e-mail addresses you have stored in Outlook.
Do you want to allow this?
<check-box> Allow this for <drop-down> 1 min, 2 mins, 5 mins or 10 mins


This occurs when the macro accesses the TO address of an MailItem in my
Inbox; the prompt does not appear if I do not access the TO address. Is
there any way to avoid this popup (short of not accessing the TO address) ?

Environment:
I am running Outlook 2002 SP2, which connects to an Exchange 2000 server and
also connects to the POP3 and SMTP servers of an external ISP. All email
comes from and goes out through the external servers. Exchange is really
only used to share public folders, calendars, tasks, etc. between the two
people in our small company. We each work out of our home offices; we each
have a Win2k multi-master domain controller (which comprise a single domain)
that also is our local exchage server. The public folders are replicated
across servers through a VPN connection between our offices.

Thanks,

Mark
 
K

Ken Slovak - [MVP - Outlook]

NewMail isn't the best event for that, it only fires at intervals and not
for every item that comes in. You'd be better off using the ItemAdd event
for the Inbox's Items collection.

You are running into the security prompts for the Outlook object model
guard. See http://www.slipstick.com/outlook/esecup.htm#autosec for your
options. BTW, if you upgraded to Outlook 2003 then any Outlook object
derived from the intrinsic Application object in Outlook VBA is considered
trusted by default and you wouldn't get those prompts at all.

Also, see http://www.outlookcode.com/d/code/zaphtml.htm#cw for an example of
an ItemAdd handler for the Items collection of the Inbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top