Archive

Posts Tagged ‘email’

Extracting emails from Gmail and Google Apps for Domains

January 20th, 2008 jvallery 8 comments

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!

Categories: Random Thoughts Tags: , , ,