Working with Mail Messages

E-mail messages in Outlook are represented by the MailItem object. When creating custom Office applications, you will need to deal with messages in two ways: retrieving information from received messages, and creating and sending new messages.

Using Received Messages

By default, Outlook places received messages in the Inbox folder. If you need to know as soon as new mail has arrived, you can use the NewMail event (covered in detail later in this chapter). You can use the GetDefaultFolder method to obtain a reference to the Inbox folder, then use the Items collection to access all the messages in the Inbox.

The MailItem object has a large number of properties. Those properties that are of interest when you are dealing ...

Get Office® XP Development with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.