new mail processing

  • Thread starter Thread starter phil cunningham
  • Start date Start date
P

phil cunningham

I want to use Outlook 2003 to filter the junk email (which is does well) and
everything that arrives in the INBOX I want to forward to another email
address.

How do I set up an event which is triggered for every mail that arrives in
the INBOX.


I've tried the Application_NewMail but this only tells me that something has
arrived and I need something more specific.

If anyone can help I'd would be much appreciated

Thanks
Phil
 
NewMail only fires at intervals also. ItemAdd on the Items collection will
provide an Item reference of what arrived. However, if more than 16 items
arrive at once it won't fire and if your ItemAdd code takes too long to run
you'll miss subsequent events while you are in that event handler.

That said, see http://www.outlookcode.com/d/code/zaphtml.htm#cw for an
example of an ItemAdd handler.

One other thing, there is no guarantee of when you ItemAdd code will fire
related to when the junk filter and any rules also fire. So if move an item
that also is caught by either rules or the junk filter you might get an
error message that the item was moved or deleted.
 
I have written some script which parses mail items from the back (newest) in
the collection untill it hits 2 already read e-mails in a row, this tends to
get around the problem of the event not firring for every mail, ...

basically at the end of your handler go through all items that are unread
untill you hit read e-mails, this works, since sooner or latter a new message
arrives and triggers the whole thing, it is a bit redundant but it works.
 
You can also add a user property to each item that's processed and then
search for that user property at intervals in the Inbox.Items collection.
That's very quick since your search filter will only return items that
haven't been processed already.
 
Back
Top