Extracting emails from Gmail and Google Apps for Domains

January 20, 2008 – 4:09 am

First off, I’ll get the link out of the way. If you go to http://vallery.net/gmail/ you can see this application in action. Now a little bit more about it.

I discovered that over the years I haven’t exactly been great about maintaining my addressbook. I’ve lost touch of many of acquaintances that I have had casual communication with. I realized that their email addresses where trapped in the deep bowels of my Gmail account, if only there was some way to extract them. I quickly realized that using the newly released IMAP protocol I could probe every message and then extract out the email addresses from it, and in some cases even additional data like the first and last name. I started playing around with the scripting a bit and came up with what I have now. This tool goes out to the Gmail IMAP server and downloads the message header from ever email that is stored in my Gmail account (except the SPAM folder). It pulls them into a master list, along with the first and last name if available. After all of the emails have been extracted it calculates some basic statistics including frequency of occurrence, which it users to sort them on. All of this information is then exported into CSV files that are compatible with many different applications.

While doing this I discovered an additional use for this data. On many of the social networking sites like Facebook and LinkedIn they will allow you to import a contact list file and find everyone that has registered for the service that you already know. This turned out to be a really killer app for this functionality. The only challenge was that they limit your ability to upload contacts to about 2,000 at one go. I added some additional functionality to my extract that “chunked” the file into several files, each with 2,000 email addresses in it. This allowed me to upload my newly discovered contacts a bit at a time, which worked very well.

If you would like to extract the email addresses from your Gmail or Google Apps for Domains account head over to http://vallery.net/gmail/ and give it a whirl!

  1. 5 Responses to “Extracting emails from Gmail and Google Apps for Domains”

  2. This worked great. I’m donating now.

    By John Sharpe on Feb 20, 2008

  3. works great. just hope you don’t use/abuse the access you are given to do this! donating now- thank you!

    By Brandon on Mar 1, 2008

  4. Excellent tool, ur a genius! Will be donating. But u might want to instruct people where to receive their email results, cos for a moment I was stonned.. didn know what to do.
    The addressed will be sent to your email account.

    By R.Roberto on Mar 13, 2008

  5. This thing IS NOT WORKING. The file you receive to your email is EMPTY !

    But a great way to steal passwords from people who turst this kind of online SCAMS !!!

    By Patrick on May 30, 2008

  1. 1 Trackback(s)

  2. May 15, 2008: extract email address

Post a Comment