Forwarding a Message
Forwarding a message involves many of the same tasks as sending an original message. First, you must open the default message store and the folder that is designated to hold outgoing messages, typically the Outbox, and call this folder's IMAPIFolder::CreateMessage method to create the message to be forwarded. You must also open the folder that holds the original message, typically the Inbox. For information about opening different folders, see Opening a Folder.
The main difference between creating a message to be forwarded and creating the original is that with a forwarded message, most of the properties are either based on or copied directly from properties of the original message.
To forward a message
-
Open the default message store. See Opening the Default Message Store.
-
Open the Outbox folder. See Opening a Folder.
-
Call the Outbox's IMAPIFolder::CreateMessage method to create a new forwarded message.
-
Call the original message's IMAPIProp::CopyTo method to copy the following properties to the forwarded message:
-
Copy the message attachments from the original message either by calling the original message's IMAPIProp::CopyTo method to copy the PR_MESSAGE_ATTACHMENTS property or by invoking the following three step procedure for each attachment to be copied:
-
Call the new forwarded message's IMessage::CreateAttach method to create a new attachment.
-
Call the original message's IMessage::OpenAttach method to open the attachment to be copied.
-
Call the original message's IMAPIProp::CopyTo method to copy all of the attachment properties from the old attachment to the new one.
-
Do not include the following properties in your call to IMAPIProp::CopyTo:
PR_CLIENT_SUBMIT_TIME |
PR_MESSAGE_DELIVERY_TIME |
PR_MESSAGE_DOWNLOAD_
TIME |
PR_MESSAGE_FLAGS |
PR_ORIGINATOR_DELIVERY_
REPORT_REQUESTED |
PR_RCVD_REPRESENTING properties |
PR_READ_RECEIPT_ENTRYID |
PR_READ_RECEIPT_REQUESTED |
PR_RECEIVED_BY properties |
PR_REPLY_RECIPIENT properties |
PR_REPORT_ENTRYID |
PR_SENDER properties |
PR_SENT_REPRESENTING properties |
PR_SENTMAIL_ENTRYID |
PR_SUBJECT_PREFIX |
|
-
Format the message text by adding indentation and a header paragraph that includes the original sender, date of transmission, subject, and recipient list. Do not include Internet-style prefix characters with the content.
-
Call ScCreateConversationIndex, passing in the value of the original message's PR_CONVERSATION_INDEX property.
-
Set a prefix for the forwarded message. If you are using the standard "FW:", concatenate these characters onto the beginning of PR_NORMALIZED_SUBJECT and set PR_SUBJECT to this new string. Do not set PR_SUBJECT_PREFIX. If you are using a nonstandard prefix, such as a string longer than three characters, store it in PR_SUBJECT_PREFIX.
-
Set the PR_SENT_REPRESENTING properties to the corresponding values in the PR_RCVD_REPRESENTING properties.
-
Create a recipient list. See Creating a Recipient List.
-
Call the forwarded message's IMAPIProp::SaveChanges method to save it or IMessage::SubmitMessage to save and send it.