An incoming message is a message that has been sent across one or more messaging systems. It may have been sent only to you or to many other recipients. Incoming messages are placed in a receive folder designated to hold messages of a particular class. You can set up a different receive folder for each message class that you handle or use one folder for all of the classes.
If you have registered for new mail notifications with the message store, you will be notified whenever a message is placed in a receive folder. If you have not registered for new mail notifications, you must open the appropriate receive folder periodically to manually check for the arrival of new messages.
Clients register for new mail notifications by setting the parameters to IMsgStore::Advise as follows:
The lpNotifications parameter in the call to your IMAPIAdviseSink::OnNotify method points to a NEWMAIL_NOTIFICATION structure that contains information about the incoming message, such as its message class, its entry identifier, the entry identifier of its parent folder, and the contents of its PR_MESSAGE_FLAGS property. For more information about registering for and handling notifications, see Handling Notifications.
Before displaying an incoming message to a user, determine if its message class is a class that your client supports. If not, ignore the message. If the class is one that you support, you can open and display the message with a form that is appropriate for the message class of the message. The choice of forms is based on message class. Messages that belong to the IPM class use a default form implemented by MAPI. Messages that belong to custom classes defined by clients can use either client-defined specialized forms or the MAPI default form.