Receiving Messages with TNEF Custom Attachment Processing
To receive a TNEF message with customized attachment processing
-
Import all the transmittable properties — those that the messaging system supports — from the incoming message into a new MAPI message. This includes the message text, which contains the TNEF data stream.
-
Identify and decode the special attachment that contains the TNEF stream.
-
Extract all the attachments from the incoming message into MAPI attachments on the new MAPI message. The recovered filenames, or other identifying markers on the attachments, should be placed into the PR_ATTACH_TRANSPORT_NAME property of the new attachments so that the ExtractProps method can later associate the correct attachment with the attachment tags encoded in the message text.
-
Create an OLE IStream object to wrap around the decoded TNEF stream and use that object along with the new MAPI message in a call to the OpenTnefStreamEx function.
-
Call the ITnef::ExtractProps method to recover the nontransmittable properties on the message from the TNEF data stream.
-
Call the ITnef::OpenTaggedBody method with the MAPI_CREATE and MAPI_MODIFY flags set. This call removes the attachment tags from the message text and converts them into attachment position information in the MAPI message.
-
Deliver the message through the MAPI spooler.