Solved

Import email with attachments from MS Outlook to mySQL in linux

Posted on 2003-11-26
20
957 Views
Last Modified: 2013-12-15
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?
0
Comment
Question by:lothlorien
  • 9
  • 5
  • 3
20 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9833515
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.
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9833526
... 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.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 125 total points
ID: 9857672
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9890734
Do you need more information?
0
 

Author Comment

by:lothlorien
ID: 9894074
How do I connect to the Linux server with MS Outlook? I will be setting up a POP3 mail server
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9894132
Are you using Outlook Express, or the "real" Outlook?
0
 

Author Comment

by:lothlorien
ID: 9894628
I'm using Microsoft Outlook, "real" Outlook.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9895179
> 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
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9895835
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.
0
 

Author Comment

by:lothlorien
ID: 9901619
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 http://www.tietew.net/soft/OE2/index.en.html 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?
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9901647
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 http://alma.ch/perl/mail.html 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.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9902553
> .. 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 ;-)
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9903148
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.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9903184
> ..  IMAP: This protocol leaves the emails on the server.
probably, if you configured it to do so :)

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

Sounds like more people are strugglinkg with MTA vs. MUA, and mail vs. mailbox, and local vs. remote, etc.
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 9903313
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 sendmail.cf file in ten years? :-)
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9903800
no offence, khkremer :-)
even I've written senmail.cf 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 ..
0
 
LVL 44

Assisted Solution

by:Karl Heinz Kremer
Karl Heinz Kremer earned 125 total points
ID: 9903866
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.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now