Understanding Messages

The Current Messages

The workgroup extensions for Word maintain two current messages in memory. The current outbound message is the message you are preparing to send with MAPISendMail or to save with MAPISaveMail. The current inbound message is the message you most recently read with MAPIReadMail. MAPISet helper functions update the current outbound message, while MAPIQuery helper functions retrieve information from the current inbound message.

To send the current outbound message, use MAPISendMail. To save the current outbound message in the Mail Inbox without sending it, use MAPISaveMail. To retrieve a message from the Inbox and make it the current inbound message, use MAPIFindNext and MAPIReadMail.

The workgroup extensions for Word initialize both current messages when your macro calls the MAPILogon function. It removes both current messages from memory when your macro ends.

Recipients

Messages are sent to a recipient list. Each recipient is identified with a friendly name and an address. A friendly name is the descriptive name of the user. Friendly names can be ambiguous, so additional information is required to guarantee unique addressing. The address is a unique string that contains the account name of the user and must be unambiguous. The address string format varies depending on the configuration of the Mail transport system and must be obtained from the workgroup extensions before it can be used. The workgroup extensions return both strings for recipients that are selected using the Mail Address Book.

When setting message recipients, use both the name and address strings to avoid problems with ambiguous names. If you do not supply an address string, the recipient is treated as unresolved. When sending a message, the workgroup extensions will automatically attempt to resolve unresolved recipients and will return an error if it cannot resolve all recipients. You can use MAPIResolveName to force resolution before sending.

WBMAPI.DLL initializes a recipient list for the current outbound message when your macro calls the MAPILogon function. It removes the recipient list from memory when your macro ends.