user1940318
user1940318

Reputation:

How to create .msg file in java using javax mail API

I just wanted to know, is it possible to create .msg file(that can be opened using ms-outlook) using javax mail API.

Thanks.

Upvotes: 5

Views: 12032

Answers (4)

Reto Höhener
Reto Höhener

Reputation: 5808

Other alternatives:

Upvotes: 0

jmehrens
jmehrens

Reputation: 11045

Hi, can we create an .eml file that cen be opened using outlook.If yes then how...

You can open files from the command line in Outlook. Search for Command-line switches for Outlook There is a undocumented /eml switch that can be used to open the MIME standard format. For example, outlook /eml filename.eml

There is a documented /f switch which will open msg files. For example outlook /f filename.msg

Upvotes: 1

m-szalik
m-szalik

Reputation: 3654

There is a project on javamail. The module javamail-file-transport is a JavaMail transport that creates msg files on local disk instead of sending real email.

GitHub: https://github.com/m-szalik/javamail

Upvotes: 1

Bill Shannon
Bill Shannon

Reputation: 29971

I believe a .msg file is in a Microsoft proprietary format; there's no easy way to create such a file with JavaMail.

However, Outlook might be able to read a .eml file, which is in MIME standard format. JavaMail can create such a file using the Message.writeTo method.

Upvotes: 1

Related Questions