Java Lib for writing outlook msg files?

TheBuzzer

HACK THE WORLD!
Joined
Aug 15, 2005
Messages
13,028
Is there any such library. I am trying to make my program make a predefined outlook msg with a attachment to speed up the workflow.

I don't see a library that can generate msg files however.
 
Do you specifically need it to be an outlook message? Or are you just trying to send an email?
 
I need it to be an outlook message. I don't want it to automatic sending a email but create an outlook email that people can edit with their own stuff before it sends.
 
There are third party FOSS extensions to the JavaMail API, however I've only ever heard of them being able to manipulate Outlook Express mail stores. I've also never used any of them personally so I can't vouch for the quality of the code.

There is a propriety licensed, closed-source set of libraries called Java Exchange Connector, that apparently enables Java interaction with an Exchange server. The evaluation download includes the API docs. Again, I have not used this product so I can't vouch for its effectiveness.


If you had something simpler in mind like just opening outlook and preloading a to, subject, message body in a new email you can make use of the JDesktop Integration Components (JDIC) api which is standard now in JavaSE 6. You can read about in the JavaSE 6 API for java.awt.Desktop class. Specifically the Desktop.mail(URI) method. You'll need to familiarize yourself with mailto URI's. The specification can be found in IETF rfc 2368
 
Last edited:
well main thing is attachments.

mailto html tag can fill up body and stuff but i dont think there is anything that can do an attachment by default.

Well there is but that is for local files and not files on the web. but the website generates the file too.


So I need to make it save it into a msg file or something
 
well main thing is attachments.

mailto html tag can fill up body and stuff but i dont think there is anything that can do an attachment by default.

Well there is but that is for local files and not files on the web. but the website generates the file too.


So I need to make it save it into a msg file or something

You could possibly write a simple email client using Swing and the JavaMail API that would allow you to edit a message and then send or store a message somewhere (a file or database)with an attachment ready to go. Short of that you might have to use one of the tools I linked above if your dead set on using Outlook somehow.
 
Ya because my web program is using glassfish. I don't care about emailing the mail. It is to generate a mail that outlook can open.

It is to help improve the speed of the workers in dealing with mailing the stuff needed.

Lot of workers are not that great with computers and their typing skills. So if I could reduce work they can get more stuff done.
 
Hi.. I need to do the same thing. Was a solution ever posted? Maybe open source..
 
I have no idea if it will work with outlook, but MIME is pretty trivial and should be supported in any decent mail client, but it's Outlook so who knows.

Check javax.internet.mail
 
Yea.. I am using javax.mail.internet.MimeBodyPart in my code. it seems that MS Outlook .msg files actually have added formatting specific to MS Outlook. Without their propriatory formatting, Outlook does not know what to do with it. I looked at the POI HSMF API, but the write() method is not implemented yet for this purpose.
 
BTW, I wound up using JavaMail to retrieve messages from the Exchange, and a third party lib JMSG to save the messages in a MS Outlook recognizable formatted .msg file.
 
BTW, I wound up using JavaMail to retrieve messages from the Exchange, and a third party lib JMSG to save the messages in a MS Outlook recognizable formatted .msg file.

where is jmsg library?
 
Yea.. I was hoping the POI lib would be expanded .. but the project couldn't wait for it unfortunately..

I redid the code using another lib that made it easier.. using JMSG is basically recreating the message from the inputstream and saving it to .MSG file... so I decided to go with "JWebDav for Exchange", both by Independentsoft.com. It takes care of setting all the properties of the MSG file as well as attachments. You can also do the same with JMSG, but it takes over double the amount of code to do what JWebDav does automatically.

I don't work for Independent Soft, so if there is something better out there definitely let me know.
 
Rather than writing a file, wouldn't the best solution be to do some sort of OLE control of Outlook?
 
Back
Top