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.
Related
I need to get contact list from Outlook Exchange. The problem is that I have to use Java and I totally don't know where to start. Can anyone tell me what I have to do firstly?
How can I programmaticaly connect to Outlook?
If you are running on Windows you can probably use JaWin. It is an open source library that wraps COM object and provides you a Java API to access them. As far as I remember its distribution contains example of how to connect to MS Exchange server.
Other similar packages I know are
Jintegra (costs some money)
Jinterop (open source too)
Both libraries implement DCOM protocol in Java, so you can run application that uses them on any platform and connect to exchange server.
Other way is to use POP3 or SMTP protocol also supported by Exchange. There are a lot of packages that support them, e.g. JavaMail.
And the last way: if your application is running on client side, i.e. on the client's computer it can parse files created by outlook itself. I do not remember where these files are stored but I remember that many years ago I have discovered the issue and saw that all emails are stored in file system in clear text format.
EDIT: Recently I found out JACOB: other library that uses JNI (like JaWin).
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.
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).
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.
I want to create a JAVA application which will access my MS Outlook and download attachments from some received mails. I can not access the MS Exchange server directly and thus I plan to connect to local copy of MS Outlook installed on the machine, and then access the folder and mails from there.
The problem is I can not get any good open source libraries to connect to outlook frommy java application.
After a lot of research I found it can be done using JACOB, but it looks like an old library and I am not sure whether I should use it.
Any suggestions/ideas to get it done? I am not allowed to connect to Microsoft Exchange Server directly so JAVAMAIL is of no use..:(
I also got this code snippet but I can't make anything out of it.
Aspose.Email also be helpful, but it is not open source. I have not tried the outlook part of it though.
http://www.aspose.com/java/total-component.aspx