Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes Converting emails to records--Using Java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Converting emails to records--Using Java application" Watch "Converting emails to records--Using Java application" New topic

Converting emails to records--Using Java application

SwetaSweta Singh

Joined: Dec 12, 2008
Posts: 6
Let me explain a bit for clarity and to arrive at a feasible solution.
I use microsoft outlook. I receive 500 emails daily in microsoft outlook from the exchange server. I want the emails received in microsoft outlook to be automatically redirected to a database i.e Ms access or MY SQL or oracle or SQL Server.
How can I do this? Which of the databases will be the best? Will I need any third party software to do this or this can be done directly without using any third party software. Thank in advance to all responding.

Here is why I want to do it.
I want to send the email to the db and then I want those mails to be fetched by 10 users through an applicaton(built in Java) within a LAN. Each user will fetch a mail one by one so the the same mail does not get locked by two or more users. After working on the fetched mail the user will then release the mail after updating the other corresponding fields for the mail in the db. I cannot fetch mails one by one in outlook and I will not know if the same mail has been read by the other users and the appropriate action taken.

An example:
Let us for example have 3 mails received in Inbox. The mails will have three fields like Name, Contact No and Message. The mails will be moved to the DB with all these fields and the data against each field. Let us now call each mail a record once it has moved to the DB. Three more fields like "category", "subcategory" and "response" to be sent to the mail sender will be added to each record in the DB to each mail(record) received. The front end of the application will show each message of the fetched record and the category and subcategory fields for corresponding fetched record will also be chosen through a drop down menu by the person who has fetched that email. The chosen option from the drop down through the front end will update the field of the db for that particular record which has been fetched. In short, the drop down will categorise the mail and then sub categorise. As per categorisation the "response" field will get automatically updated will already stored formats of messages. Now the contact number of the user and the corresponding responses will be shown and exported to an excel sheet.

How can I do all this through a java application?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41029
Instead of trying to automate mail processing within the client, I'd look into doing that on the server. Most mail servers have to capability to perform custom processing for incoming mails. If you run code that stores the mail into the database right then, your task is reduced to writing the Java GUI that accesses the DB through JDBC, and lets the users perform whatever tasks they have to perform with the mails.

Ping & DNS - my free Android networking tools app
SwetaSweta Singh

Joined: Dec 12, 2008
Posts: 6

That is the best option but actually I wanted to do this through a program due to some specific reasons.

Please let me know if this is possible in Java.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41029
Not without major headaches. The Java code would need to read the files where Outlook stores emails. The Apache POI project has some rudimentary code for this, but I have no idea whether that'd be sufficient to accomplish this.

If you were able to get the email data from those files, then it'd be comparatively easy to store them in a DB or an XLS file.

What are those "specific reasons"?
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Originally posted by Ulf Dittmer:
Not without major headaches. The Java code would need to read the files where Outlook stores emails.
Yes, it would be a lot easier to read the e-mail messages directly from the Exchange server via IMAP. Were there specific reasons why you weren't allowed to do that, or did it just not come up as a possibility?
wood burning stoves
subject: Converting emails to records--Using Java application
Similar Threads
Database Synchronization...
How to store mails on local file system?
Dynamic Drop down based on another value in the same form
Populating Drop Down From Database
How to access shared mailboxes using JavaMail