Biztalk to generate outlook .msg format file RRS feed

  • Question

  • Hello Guys,

    I have been tasked to generate an outlook (.msg) formatted file reading the email and I am not sure how will biztalk generate .msg format file. 

    Details on the flow:

    a) Receive email from a mailbox using POP3 adapter

    b) Using an Orchestration to read the email body , subject.

    c) Strip down attachments and save to a directory.

    d) save the complete email received in a msg outlook format.

    I am finding difficulty in determining on how to perform (d).

    Any suggestion would be highly appreciative.



    Wednesday, February 7, 2018 7:17 AM

All replies

  • I think it is not possible Out of the Box in BizTalk to write a msg file down.

    In my opinion your best option is to use an Orchestration, and from there call out a C# helper to do that.

    There is an Outlook MSG .net library that you could find useful: http://www.independentsoft.de/msg/

    Wednesday, February 7, 2018 11:38 AM
  • This is definitely a situation where the first question is why?  This is a requirement that seems designed to create more problems than it could ever solve.

    My advice, don't even try to do this.

    Outlook's .msg is a binary format not designed for any kind of interop.

    Spend so time asking the user what they're actually trying to do, then we can help you with a workable solution.

    Wednesday, February 7, 2018 12:47 PM
  • a) Receive email from a mailbox using <g class="gr_ gr_35 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="35" id="35">POP3</g> adapter :

    b) Using an Orchestration to read the email <g class="gr_ gr_17 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" data-gr-id="17" id="17">body ,</g> subject. : This can be read in Orch using POP3 property and also email body...

    c) Strip down attachments and save to a directory. -- You can take the attachments from email in Orch easily.

    d) save the complete email received in <g class="gr_ gr_16 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="16" id="16">a msg</g> outlook format. - 

    Just send the same received POP3 message (the message from ur receive shape) as is to a send port and save the message with .msg extension...Give it a try...


    Blog: My Blog

    BizTalkApplicationDeploymentTool: BizTalk Application Deployment Tool/

    Wednesday, February 7, 2018 4:15 PM
  • Yes just save the original mime message retrieved from the pop3 account, in the file system, in a database etc


    Wednesday, February 7, 2018 4:35 PM
  • Pixelxar and Peter: I think that if you receive a POP3 message, after going through the MIME decode pipeline, once you try to write the incoming message to the orchestration to a file, it will not write an encoded MSG file...

    Maybe when using a Send Pipeline with MIME Encoding in the FILE Send Port, but not sure of it...

    Another option would be to write a Custom Pipeline component in the Receive Pipeline that writes to file location before the MIME Decode component is applied...

    To be honest, never have faced this requirement...

    Wednesday, February 7, 2018 5:25 PM
  • As John says, don't even try.

    But, Outlook is happy to read *.eml or simple plain text files.  This is what is actually sent over SMTP etc, which is all plain-text.

    To achieve this ensure you disable MIME decoding, in both the POP3 receive configuration and your Pipeline.  You will then get the original unmolested message into BizTalk which can just be popped out as text and saved as a *.eml file for Outlook.

    I think you will still get Subject and header info via the POP3 context properties even with MIME decoding disabled.

    If this is helpful or answers your question - please mark accordingly.
    Because I get points for it which gives my life purpose (also, it helps other people find answers quickly)

    Wednesday, February 7, 2018 9:38 PM