How to download email messages as .msg files - java

Programatically using Java, is it possible to download and save emails from Exchange Server as .msg files?
If not, are there any formats possible, which can be opened with Outlook

The solutions received were commercial options which for me is out of scope right now.
The second part in my question was if I can save in any other format. I have figured out that I can save them as .eml file which also can be opened in Outlook. This will solve the problem for me.

You can use Outlook Object Model (see MailItem.SaveAs) if you have a local Outlook profile configured to access the Exchange mailbox in question.
You can also use Redemption (I am its author) to dynamically connect to an Exchange mailbox (RDOSession.LogonExchangeMailbox), iterate through the messages and save them in the MSG format (RDOMail.SaveAs).

Related

How to automate conversion of email of an acount on mail server to .eml file using java

I have postfix email server configure on a linux machine. There is a email account e.g xyz#emailaccount.com is available on this mail server.
What exactly I want to do is Whatever email come to this email id should be converted to .eml file and this .eml file should be stored on a perticular location on hard disk.
I want to automate this above process using java program. I thought that my java progam will run after certain interval of time using schedular and check for any new email. As soon as he found any new email he will
convert that email to .eml file and store this file on a perticular location. The mail coming to this email id mostly dont have any attachment to them. But still I want my program robust so that if unfortunately if some
email comes with an attachment in that case the java program should not stop working.
Following are my questions that I want to ask to expert.
Is what am I expecting in above case is possible? and Whether is it possible in java?
As I checked on mail server the mail files for above email id have very long name and I dont found any extension to them. So How do I read mail in these files and convert them in .eml format using java.
If you know any tutorial related to above task or any reference link of code then please let me know about it.
I check on web and found that java have javamail api. Is this pacakage is helpfull for me to do above task or do I have to use any other api for java? If you know anything it it please let me know.
Please help me in above task friends.
Thanks in advance
Yes, it's possible.
The simplest approach is to run an IMAP mail server to allow you to read the messages using JavaMail. There are several IMAP mail servers available for Linux.
See the documentation on the JavaMail project page, especially the JavaMail FAQ.
Use JavaMail.

Read emails stored in Thunderbird with Java

I need a way to read the stored emails in Thunderbird with Java and retrieve attached files.
The problem is that I have an old FoxPro app that reads Zip files from a folder. The FoxPro used to retrieve those files from attachments into the emails in Outlook Express, when we installed Outlook 2007 this function of retrieve the files from Outlook didn't work anymore so it was replaced with a simple Java app (reading directly from the PST file). So now FoxPro app executes the Java app to retrieve those files.
Now I want to replace Outlook 2003 with Thunderbird and I want to read the emails from there.
IMPORTANT: The accounts are POP3 so I can't use IMAP to extract files directly from the email server.
There is a lib or something?
As best I know there is no Java support, directly or by 3rd party library. Having said that, I've looked at the way emails are persisted onto disk and you should be able to access those files directly with a Java app. Attachments are stored inline and although I haven't tried to code an extraction app in Java, the structure and syntax of the attachments reminded me of the way attachments are stored in newsgroups (access via NNTP).
Thunderbird stores messages in mbox (loosely described in RFC 4155) files, with separate files for index/flags. GNU JavaMail should be able to read the mail store. That's just the first implementation I found, it may not be that hard to write another one.

Copying public folders from a MS exchange server in java

I am currently looking into copying public folders and the containing emails from a MS exchange server 2003 to a local directory in window explorer, in the same structure, so I will then have the directories and the .msg files on my local drive.
I have researched this, but unsure what route to go down. MAPI, Webdav, IMAP, Javamail etc.
I will be creating a Java app to do the copying also. Also open to any other software development recommendations (Perl, C++)
What would be the best protocol to do this and also anyone got any links where I can do some more research on this subject?
Many thanks
JavaMail can't create .msg files, which are a proprietary Microsoft format, so if that's a key part of your requirements you'll need to look at something else.
If a .eml file (effectively a MIME format file) or a Unix mail format file would be sufficient, you can consider JavaMail.
JavaMail includes a demo program that copies a mailbox hierarchy from one store to another.
There are several options for storing messages locally.
Run an IMAP server on the local machine. This is probably the easiest.
Use a local store provider, such as the JavaMail mbox provider or another such provider from the JavaMail Third Party Products page.
Write your own code to store each message to disk using the MimeMessage.writeTo method.
Hope that helps.

how to open attached document from outlook using java?

is it possible to open attached document from outlook using java?
Every hour i receive email with text file attached.
i have to open and extract some data from this text file and store it into another text file.
So what i'm doing is to open the email, then right-click and save the attached file for extracting data it's ok.
How could i do it fastly?
thanks
If you receive your mails using IMAP, then you could write a Java application and use JavaMail to connect to the IMAP server, get the mail, and extract data from the attachments.
You can conntect to Outlook with a COM-wrapper. There are libraries like COM4j. You can access the email, extract the data. But IMAP is much simpler.

Programming thunderbird Email Client?

Anyone has C#/Ruby/Python/Java or Perl scripts to get all the emails in a folder in Thunderbird client and download all the attachments?
I have more than 200 resumes as attachment kept in Resumes folder of thunderbird and I need to download the attachment and categories them. Any API reference to program thunderbird would be great..
I found this http://kb.mozillazine.org/Calling_Thunderbird_from_other_programs but I am looking for specific code samples..
Other references
https://developer.mozilla.org/en/pyxpcom
If you are happy using existing tools, instead of writing your own, you could give the Thunderbird Add-on AttachmentExtractor a try.
Give this a try:
How To Bulk Export Thunderbird Email & Attachments
http://blog.taragana.com/index.php/archive/how-to-bulk-export-thunderbird-email-attachments/

Categories