问题
I have an application that allows people to attached files to records. Some users are uploading emails that relate to the record in question. All fine and dandy.
However some users are using MS Outlook and are uploading MSG files and other users are using thunderbird and upload EML files. Ideally I would like all users to upload EML files as they are interoperable and work on mobile devices too.
cut to the chase i'm looking to detect an uploaded MSG, either via extension or MIME type and converting to on the fly to EML instead and storing that. This is transparent to the user as Outlook can open EML files happily.
Does anyone know of a (free ideally) 3rd party commandline utility that I can call to do the conversion for me? Or is there a c# chunk of code I can use to convert an MSG to a EML?
Thanks
回答1:
You can use Redemption for that. Something like the following (off the top off my head) should work:
RDOSession Session = new RDOSession();
RDOMail Msg = Session.GetMessageFromMsgFile("c:\temp\YourMsgFile.msg");
Msg.SaveAs("c:\temp\YourEmlFile.eml", rdoSaveAsType.olRFC822);
来源:https://stackoverflow.com/questions/15138803/3rd-party-utility-to-convert-outlook-msg-files-to-eml-files