The following series of actions describe how transports use TNEF methods to process outgoing and incoming messages.
To send a message that includes a TNEF stream
Process the message properties that are supported by the messaging system.
Mark the message in an implementation specific way so that the receiving transport provider can determine that the message requires TNEF processing. For example, a TNEF transport provider sending to an SMTP messaging system might add a custom header field like "X-CONTAINS-TNEF" to indicate that the message contains TNEF data.
Obtain a TNEF object and uses it to encapsulate the message properties not supported by the messaging system into a TNEF stream.
Encode the TNEF stream using the messaging system's attachment model. For example, if the underlying attachment model is to uuencode attachments and append them to the message text, then the transport provider must uuencode the TNEF stream into another attachment.
The transport provider must also implement a method for recognizing which attachment contains the encoded TNEF stream when it receives a message. The standard way to mark this attachment is to give it an attachment filename of "WINMAIL.DAT". If your transport provider does this, any other TNEF-enabled transport providers that follow this convention will be able to interoperate with it.
Use ITnef interface methods to insert tags describing the positions of message attachments in the message text.
Access the tagged message text through OLE IStream methods, and send it to the messaging system.
To retrieve encapsulated properties
Write the properties supported by the messaging system into a new message, including the tagged message text that contains the encapsulated properties.
Decode the TNEF stream from the proper attachment.
Decode any other attachments and write them to new MAPI attachments on a message.
Open the TNEF stream for decoding using the OpenTnefStreamEx function.
Use the ITnef::ExtractProps method to decode the TNEF stream and write the encapsulated properties into the new message. Any encoded properties that are duplicates of nonencoded properties will overwrite them when the encoded properties are decoded.
Use the ITnef::OpenTaggedBody method to parse the message text to recover attachment positions from the tags in the message text.