Platform SDK: MAPI

Handling an Outgoing Message

An outgoing message is a message that can be sent to one or more recipients across one or more messaging systems or be posted to a folder in a message store.

To create and send an outgoing message

  1. Open the default message store. See Opening a Message Store and Opening the Default Message Store.
  2. Open the Outbox folder. See Opening a Folder.
  3. Call the Outbox folder's IMAPIFolder::CreateMessage method to create the new message.
  4. Create a recipient list with one or more resolved recipients. See Creating a Recipient List.
  5. Optionally, add a subject. See Creating a Message Subject.
  6. Add the message text. See Creating Message Text.
  7. If the message text is formatted, add rendering information. See Adding Rendering Information to Formatted Text.
  8. Optionally, add one or more attachments. See Creating a Message Attachment.
  9. Set other message properties as desired and then save and send the message by calling IMessage::SubmitMessage.
  10. Delete the sent message if the PR_DELETE_AFTER_SUBMIT property is set to TRUE or move it to the folder identified by the PR_SENTMAIL_ENTRYID property. See Processing a Sent Message.

If you want to intermittantly save the message before sending it, call the message's IMAPIProp::SaveChanges method. See Saving a Message or Sending a Message.

For more information about the role that message store providers, the MAPI spooler, and transport providers play in the message sending process, see Sending Messages with MAPI.