none
Are there ways to programmatically generate MS journal report for given e-mail ? RRS feed

  • Question

  • I want to programmatically(preferably using C#) generate MS Journal report (using EWS or alternatives) for given email(eml/msg file). 

    I have explored EWS documentation & Outlook Interop API but couldn't find any API to generate journal report. Please advise.Thank You. 

    Tuesday, December 19, 2017 3:02 AM

Answers

  • Exchange can generate MS Journal report. Used following .NET Nuget packages to generate eml file which looks like journal report.  

    1. MsgKit : for parsing .msg files

    2. MimeKit: for generating .eml file (RFC822 complaint Mime msg)

    Tuesday, July 31, 2018 6:27 PM

All replies

  • Journal reports are produced by the journaling transport agent in the Transport pipeline because this is the only place where they can have any real meaning. Eg once a Message has been delivered to a Mailbox you don't have the routing or Envelope recipients that are need to produce a correct journal report.

    Cheers
    Glen

    Wednesday, December 20, 2017 11:13 PM
  • Thanks Glen for your inputs.

    Appears Microsoft doesn't offer any API's which let's us programmatically generate journal reports. Appears other than exchange server itself, there are no other ways to generate journal reports.

    I'm required to send journaled e-mail by following MS-XJRNL Journal Record Message File Format. I'm asked to keep Journal report as baseline for comparing e-mail content file format generated by my application. I'm using RFC 822 message format. To match file format of journaled message, I'm adding few headers to the generated e-mail. It doesn't appear I can generate e-mail whose file format matches journaled report file format. 

    Could you please answer my following questions

    1. Am I mixing-up MS-XJRNL Journal Record Message File Format with Exchange journaling ? If yes, how are they different from each other ?

    2. How can I generate e-mail which complies with MS-XJRNL journaling format ? Would be great if you can share a sample e-mail in this format.

    3. Any idea what makes regular e-mail as journaled ? Does it need to have any specific headers ? I noticed journal report contains X-MS-Journal-Report. Sometimes sender & recipient headers are prefixed with X-. 

    4. Tools

        a. Does Microsoft/other vendors offers any tools which detects format of given e-mail ?

        b. Are there any tools to detect whether given e-mail confirms to specified journal format (Ex: MS-XJRNL) ?

        c. Are there any tools which generates e-mail in specified journal format (Ex: MS-XJRNL) ?

    Reference:

    https://msdn.microsoft.com/en-us/library/cc425504(v=exchg.80).aspx

    Thursday, December 21, 2017 3:32 AM
  • >>Appears Microsoft doesn't offer any API's which let's us programmatically generate journal reports. 

    That not accurate eg the Transport Agent that is generating the journal reports is just using the standard API's (eg either the TNEFWriter) that are available with Transport Agents. 

    >>I'm required to send journaled e-mail by following MS-XJRNL Journal Record Message File Format. I'm asked to keep Journal report as baseline for comparing e-mail content file format generated by my application.

    That's not a good reason to use the Journal Records format just use your own custom format so you can store all the properties needed for your application. What's the point of using journal records they are for journaling not your custom application (eg there are probably properties that you want that aren't included in the journal reports)

    >>1. Am I mixing-up MS-XJRNL Journal Record Message File Format with Exchange journaling ? If yes, how are they different from each other ? 

    Exchange journaling generates Journal Record messages the main use of which is regulator compliance https://technet.microsoft.com/en-us/library/aa998649%28v=exchg.150%29.aspx .  If you need journaling report just enable journaling and let Exchange produce them for you why do you need to produce them ? if you need a copy of the journal report just create a rule that copies them to another mailbox etc. 

    Unless you have a really compelling reason to be generating journaling messages which from what you have said you don't have I wouldn't be going down that route as you can achieve a better result by just generating your own custom format to do what you want which will save you a lot of time and effort. To generate a Journal report in a Transport Agent would require using the TNEFWritter to create create a Message with the embeed Attachment with the original message which isn't something that I've ever seen any sample for.

    Thursday, December 21, 2017 5:43 AM
  • Thanks again Glen for sharing your views. I have voted your response as helpful. 

    I will explore on TNEFWritter & other exchange API's.

    I agree with your recommendation on using custom format. However Journaled message is a vendor specification so I will still have to go down this path. The vendor to whom I'm e-mailing messages expects messages in MS-XJRNL journaled format in order for them to process the message & provide us the response e-mail back.

    I'm e-mailing messages directly to vendor SMTP host (expects journaled messages) which relays messages to the exchange. Exchange server admin mentioned that they can't share exchange server's host & port number. Exchange can only accept relayed messages from few authorized sources & one of which is messages relayed via vendor's host. 

    Say if my exchange admin set's up exchange journaling rules, messages relayed via vendor host will get journaled. But in my case I need copy of journaled message for sending it to vendor host to kick off the process. As of now exchange admin didn't agree to setup journaling rule to deliver journaled reports directly to vendor host. This is the reason why I'm required to programmatically generate journaled messages for sending to vendor host.  

    App server (my app) -> Vendor host -> Exchange server

    I have received a sample exchange journaled report (looks like images placed at the bottom of below web page) for testing whether vendor would accept this or not. I can attach it in a new e-mail envelope but it wouldn't be accurate way to test it.

    https://technet.microsoft.com/en-us/library/bb331962(v=exchg.141).aspx

    Are there ways to SMTP eml files (as is without enclosing it as an attachment in new e-mail) stored on disk ? I found below link which I'm planning to explore. Please let me know if you are aware of any alternate solutions (possibly C#,telnet, powershell or other scripting) for achieving this.

    https://docs.aspose.com/display/emailnet/Loading+EML+Files+from+Disk+and+Sending+it+with+SMTP

    Could you please direct me at exchange API classes/methods which will help me download e-mail messages from exchange mailbox ? This is for downloading vendor response messages from exchange server.

    Given my situation do you have any recommendations or suggestions to tackle this overall requirement ? Do you recommend any tools that may help me troubleshoot e-mail formatting/message journaling related issues ?

    Thanks for taking time to respond to my queries. I really appreciate your help.

    Friday, December 22, 2017 2:39 AM
  • Exchange can generate MS Journal report. Used following .NET Nuget packages to generate eml file which looks like journal report.  

    1. MsgKit : for parsing .msg files

    2. MimeKit: for generating .eml file (RFC822 complaint Mime msg)

    Tuesday, July 31, 2018 6:27 PM