Event when email is received

T

Tod

Pardon my newbieness. Is there a VB event that is triggered when
Outlook receives a new email in the inbox?

tod
 
G

Guest

There's actually three kinds of events that can be triggered when an e-mail
is delivered to your Inbox:

- the Application_NewMail event fires, but does not tell you what has been
received - not usually very helpful
- if you use Exchange, the Application_NewMailEx event passes a string of
comma-delimited EntryID values that can be used with the GetItemFromID method
to retrieve those items
- you can also hook up an Item_Add event to a MAPIFolder object hooked up to
your Inbox, which passes the singular object that was added; will fire once
for every item that comes in, but is NOT very reliable if a large number of
items are delivered/created

This link documents the last method, and you can find sample code from the
others in the Events hierarchy:

ItemAdd Event [Outlook 2003 VBA Language Reference]:
http://msdn.microsoft.com/library/en-us/vbaol11/html/olevtItemAdd_HV05254252.asp?frame=true
 

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