IConverterSession::MIMEToMAPI

Applies to: Outlook 2013 | Outlook 2016

Converts a MIME stream to a MAPI message.

HRESULT IConverterSession:: MIMEToMAPI ( 
     LPSTREAM pstm, 
     LPMESSAGE pmsg, 
     LPCSTR pszSrcSrv, 
     ULONG ulFlags 
);

Parameters

pstm

[in] IStream interface to a MIME stream.

pmsg

[in] Pointer to the message to load. The caller must supply a message for the API to fill out, so the object must go [in]. See mapidefs.h for the type definition of LPMESSAGE.

pszSrcSrv

[in] This value must be null.

ulFlags

[in] This parameter identifies any special action to be taken during the conversion. It must be zero (0) if no specific action is to be taken, or a combination of the following values:

CCSF_EMBEDDED_MESSAGE

Sent/unsent information is persisted in X-Unsent.

CCSF_SMTP

The MIME stream is for a Simple Mail Transfer Protocol (SMTP) message.

CCSF_INCLUDE_BCC

BCC recipients of the MIME stream should be included in the MAPI message.

CCSF_USE_RTF

The HTML body of the MIME stream should be converted to Rich Text Format (RTF) in the MAPI message.

CCSF_GLOBAL_MESSAGE

The converter should handle the MIME stream as an international message (EAI/RFC6530). Not supported on Outlook 2013.

Return value

E_INVALIDARG

Indicates that pstm is null, pmsg is null, or ulFlags is invalid.

Remarks

If you have specified CCSF_USE_RTF as part of ulFlags and the destination message store supports both HTML and RTF, the MAPI message will be converted to either HTML or RTF. If the message is converted to RTF, the converted format will be compressed RTF, any HTML will be embedded in the compressed RTF string, and the string will be contained in the PidTagRtfCompressed Canonical Property.

MFCMAPI reference

For MFCMAPI sample code, see the following table.

File Function Comment
MapiMime.cpp
ImportEMLToIMessage
MFCMAPI uses MimeToMAPI to convert an EML file to a MAPI message.
MapiMime.cpp
ExportIMessageToEML
MFCMAPI uses MAPIToMIMEStm to convert a MAPI message to an EML file.

See also

IConverterSession : IUnknown
IConverterSession::MAPIToMIMEStm
IConverterSession::SetAdrBook
IConverterSession::SetCharSet
IConverterSession::SetEncoding
IConverterSession::SetSaveFormat
IConverterSession::SetTextWrapping MAPI Constants