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
-
Open the default message store. See Opening a Message Store and Opening the Default Message Store.
-
Open the Outbox folder. See Opening a Folder.
-
Call the Outbox folder's IMAPIFolder::CreateMessage method to create the new message.
-
Create a recipient list with one or more resolved recipients. See Creating a Recipient List.
-
Optionally, add a subject. See Creating a Message Subject.
-
Add the message text. See Creating Message Text.
-
If the message text is formatted, add rendering information. See Adding Rendering Information to Formatted Text.
-
Optionally, add one or more attachments. See Creating a Message Attachment.
-
Set other message properties as desired and then save and send the message by calling IMessage::SubmitMessage.
-
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.