Import email with attachments from MS Outlook to mySQL in linux

I have a linux server and a Windows pc. How do I extract all of the current attachments from windows MS Outlook to import into the linux server's mySql? I thought of using OASniffer to extract, vb ftp over and write a script to import to mySql. Any other more efficient way to automate this?

I have also tried with MS Outlook export to csv file, but it can't handle attachments. So I can't use that.

For future emails, I'm able to do this by the recommended xeoport software. Any workaround for current emails with attachment?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Karl Heinz KremerCommented:
I would set up a pop3 or imap server on the Linux server, connect to this server with out Outlook, and then drag&drop the folders (or individual emails) that you want to export to a folder on the Linux mail server. This way, you will end up with a "normal" email file. You could then take this file, and run a script over this file, extract the attachments and do whatever you need to get them into your database.
Karl Heinz KremerCommented:
... and if you are going the IMAP route, make sure that the IMAP server does use standard mail spool files an not a database (like the Cyrus server). The UW IMAP server would be a good choice.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Karl Heinz KremerCommented:
Do you need more information?
lothlorienAuthor Commented:
How do I connect to the Linux server with MS Outlook? I will be setting up a POP3 mail server
Karl Heinz KremerCommented:
Are you using Outlook Express, or the "real" Outlook?
lothlorienAuthor Commented:
I'm using Microsoft Outlook, "real" Outlook.
> How do I connect to the Linux server with MS Outlook?
as you connect to any other (POP)server also, like Exchange.
Simply create a mailbox where you specify POP
Karl Heinz KremerCommented:
On my version of Outlook 2000 (but this is the Coroporate or Workgroup edition), I go to the "Tools" menu, select "Services", select "Add", select "Internet EMail" from the list. Then on the dialog that pops up, go to the "Servers" tab and specify your POP3 server.
lothlorienAuthor Commented:
Thanks, I'm connecting to a POP3 mail server but how to do the below as suggested by khkremer?
"...drag&drop the folders (or individual emails) that you want to export to a folder on the Linux mail server..."
See if I understand correctly, the above means can drag and drop from MS Outlook to Linux mail server?

I've tried this link from ahoffmann. I'm able to create .mbx file but I need help in breaking the messages apart in linux. After this I need to import the messages into mySql with attachment and everything. Could anybody help in advising using what language or script to break and insert/retrieve the mail from mySql?
Karl Heinz KremerCommented:
When you open your Outlook, you will see two different mailboxes after you connect to the POP3 server: The POP3 server and your local mail box. Just select a folder or one or more messages from the local mail box and drag&drop them into a folder in the POP3 mail box. This will create a mail file on your server (in your own account). This file is straight ASCII, and you can use any language that allows you to take a mail box file appart. I would use Perl. This link has a number of links for mail related packages for Perl. Look at the CPAN stuff, it provides pretty much anything you need to write any Perl application. Lot's of available modules (libraries), so that you don't have to write all the functionality yourself.
> .. can drag and drop from MS Outlook to Linux mail server?
Sopunds you're not used to functionality of mail, in particular the difference of an MTA (mail transfer agent == server) and MUA (mail user agent == client).

POP is a protocol which transfers (downloads) the mails, or complete mailbox, from an MTA to your MUA (Outlook for example). There is no way to upload mails using POP3.

If you want to store your mails (your mailbox) on the server (MTA), then you need to setup an MTA which allows this, for example using IMAP.

If you have an MTA which can hold your mailbox, then you need to configure 2 local mailboxes in your MUA (Outllok): one with POP3 to get all your mails downloaded to Outlook, and another with IMAP where you can store your mails on the MTA.
If you have both local mailboxes, then you can drag&drop.

BTW, above is the click&type/drag&drop M$ solution.
In other worlds (*NIX for example), you simply configure a procmail/fetchmail which might do it all automatically ;-)
Karl Heinz KremerCommented:
Fetchmail would not work in this instance because the task is to convert emails that are stored in MS proprietary format in a local mailbox (not accessible to fetchmail or any open source program) into a format that can be parsed and processed.

But you raised a valid point (it's been a while since I last used POP3): When you use POP3, OUtlook will create a local mail box, which means that your emails are stored on your local machine again. This is why my first comment talked about IMAP: This protocol leaves the emails on the server. So POP3 is not a solution that will work in this case, you have to use IMAP.
> ..  IMAP: This protocol leaves the emails on the server.
probably, if you configured it to do so :)

> ..  you have to use IMAP.
you might use IMAP.

Sounds like more people are strugglinkg with MTA vs. MUA, and mail vs. mailbox, and local vs. remote, etc.
Karl Heinz KremerCommented:
The "have to" was in comparison to POP3. In this case POP3 will not work. Because we only have two open protocols (that I know of) that communicate with a mail server, the choices are POP3 or IMAP. Also, because the solution I proposed requires that you let Outlook move mail from the local machine to a server in order to make it accessible, that leaves IMAP, so my "have to" is appropriate.

I don't get the last sentence of your comment. Are you trying to insult me because I have not written a file in ten years? :-)
no offence, khkremer :-)
even I've written more than 10 years ago, I'd not blame someone for not doing this true slave work ;-)
The last sentence was 'cause I got the feeling that some people (probably you too) don't know what IMAP can do also; and you need to knwo all these "vs." ;-)
<by>do brauchst di nocha net ärgern, des is ois nur a Spass</by>

Sorry for being off-topic, somehow ..
Karl Heinz KremerCommented:
Let's get back on track here: Maybe I have another solution for you: Mozilla (the Windows version) seems to be able to import Outlook files. If this works, you can skip the whole IMAP installation.
Disclaimer: I've never done this myself. I just noticed that Mozilla has this option under "Tools>Import>Mail". Then select Outlook and see what happens.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.