Event when email is received

Event when email is received

Post by Tod » Sat, 29 Oct 2005 22:43:56

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


Event when email is received

Post by Ken Slovak » Sun, 30 Oct 2005 00:39:09

ItemAdd in the Inbox collection, NewMail (which fires at intervals only) and
for Outlook 2003 you also have NewMailEx. Both NewMail and NewMailEx are
events of the Application object.

For an example of an ItemAdd handler see

Ken Slovak
[MVP - Outlook]
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options


Event when email is received

Post by RXJpYyBMZW » Sun, 30 Oct 2005 00:44:02

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]:

Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard for Outlook:
Blog: http://www.yqcomputer.com/