STOP BEING REPLIED NO...
START HAVING WHAT YOU WANT!

6 secrets for a successful salary raise negotiation

version fran├žaise

How to extract email addresses from mbox files for LinkedIn with a Perl script


Olivier Langlois, IT superstar coach, Dominate LinkedIn Formula author
by Olivier Langlois







There is a page on LinkedIn allowing you to import Contacts and invite people you know. You can grant LinkedIn the right to import your contact list automatically from several popular online email service providers.

LinkedIn import connection page

If you are old school like me then you have an email client installed on your computer. Most email clients will offer to export your contacts list into a file format that LinkedIn will accept (.csv,.vcf). If you are like me again and do not use much the contacts and instead just retrieve the last email received from the person and click reply to send an email to that person, you are in the same situation that I was in before creating this web page. I have not found exactly a tool that extract the email addresses from my emails so I wrote a script doing exactly that.


mbox format is the format used to store emails by Mozilla Thunderbird and evolution email clients and possibly many others. This is another example of the elegance of the UNIX philosophy. The format is simply a dump of the payload of the Internet email protocol (RFC2822) into a text file. This opens up the door to new and unexpected usage such as my script. Note that this type of freedom would be harder if not impossible with proprietary binary format.

The script: extract_emails.pl (just right click and select 'save link as...')

How to use: extract_emails dir_where_mbox_files_are > contact_emails.csv

ie: extract_emails.pl ~/.local/share/evolution/mail > emails.csv

There are a couple of things to be aware with the output before submiting it to LinkedIn:

In terms of result, personally, I have been able to extract almost a thousand email addresses from my email account box. If you have found the information contained on this page useful then you might be interested in the book that I have writen:

Dominate LinkedIn Formula ebook