How to save complete complete mail (body and attachment both) at Transport Agent in .msg format? RRS feed

  • Question

  • Hi,


    I have to save complete mail that a user received at Transport Agent in .msg format but can not find any way to do this. Actually we get a mailItem  of type Microsoft.Exchange.Data.Transport in transport agent and what I want is to extract the complete mail from mailItem object and save it in .msg format. Also by achieving above I wanted to preserve the mail format as is i.e. if a user sends the mail in TEXT/HTML or RTF format then the saved mail should have preserved the actual mail format.


    Monday, August 22, 2011 11:10 AM


  • Taj,

    Sure you need msg format ?? eml format is trivial to write (and can be read by Outlook or Outlook Express) ?

    If saving to an eml file is good enough, then the sample code in the Transport Agent SDK will show you how.

    If you must save to msg then have a look at the source for MFCMapi (a Google search should find it for you).

    - Scott

    • Marked as answer by Taj_Sengar Tuesday, August 21, 2012 1:45 PM
    Thursday, August 25, 2011 9:49 AM