Search code examples
testingjakarta-mailgreenmail

How can I load .msg file into GreenMail mailbox


I'd like to load .msg bounce mail sample to GreenMail mock mailbox for testing. How can I do that?


Solution

  • I figure I'd just share my findings.

    Firstly this is beyond GreenMail library scope. You could use JavaMail library to load a message sample, preferably an .eml file and store them in the dummy mailbox created using GreenMail.

    Secondly, .msg is an Outlook message file, a proprietary of Microsoft. And as I post this, currently there are no free Java library that can successfully load and convert .msg file into raw message format, .eml which what JavaMail can work on.