1

I am trying to save a java mail message (javax.mail.Message) as an outlook message (.msg extension).

However, Message.write(FileOutputStream) does not allow me to open the outlook file. It receives an error about permissions or the file was not found.

I have tried to use apache-poi (3.7), however, running into problems there also:

MAPIMessage outlookMsg = new MAPIMessage(msg.getInputStream())
outlookMsg.write(out)

where msg is a javax.mail.message and out is a fileoutput stream.

I get the following error : Invalid header signature; read 0x415F3030305F2D2D, expected 0xE11AB1A1E011CFD0

What is the solution to solve this? Should I save with java mail another way?

Thank you in advance.

Chandan Kumar
  • 4,570
  • 4
  • 42
  • 62
vanschaickp
  • 71
  • 2
  • 7
  • This must be because the file is not a valid OLE2 file. check this http://stackoverflow.com/a/7100758/624003 – Sankumarsingh Jan 14 '14 at 00:25
  • Outlook has a proprietary .msg format that they haven't yet released. The apache-poi won't work because the write method is not support (most likely waiting for support). There are some third party apps that you can use (Aspose and JMSG). You can also save the message with an eml extension and follow http://support.microsoft.com/kb/956693 to get it to open with Outlook. – vanschaickp Jan 14 '14 at 15:24

0 Answers0