Posting a Message
Posting a message is similar to sending a message. The main difference is the destination. Rather than being directed to one or more recipients across one or more messaging systems, a posted message remains in a folder in the current message store.
To post a message
-
Open the destination folder by calling IMsgStore::OpenEntry. If the destination folder is the Inbox, locate the entry identifier to pass to OpenEntry by calling IMsgStore::GetReceiveFolder.
-
Call IMAPIFolder::CreateMessage to create the message.
-
Call the message's IMAPIProp::SetProps method to set:
-
The MSGFLAG_UNSENT flag in the PR_MESSAGE_FLAGS property.
-
The PR_SENDER properties.
-
The PR_SENT_REPRESENTING properties.
-
The PR_RECEIPT_TIME property.
-
The PR_RTF_COMPRESSED or PR_BODY property.
-
The PR_SUBJECT property.
-
Call the message's IMAPIProp::SaveChanges method to save the message.
-
If necessary, create an attachment, set its properties, and save it. For detailed information about adding attachments to messages, see Creating a Message Attachment.
-
Call IMessage::SaveChanges to save the message. At this point it will appear in the contents table of the Inbox.
Notice that you do not create a recipient list. Instead, you set several properties that are normally set by a transport provider for a sent message.
If you want to save a message intermittantly before having it appear in the contents table of the Inbox, create it instead in a hidden folder such as the root folder of the IPM subtree and then move it to the Inbox.