A universal interface to import email contacts from various providers including Yahoo, Gmail, Hotmail, AOL and Plaxo.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 5 commits behind jensb:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Welcome to Contacts

Contacts is a universal interface to grab contact list information from various providers including Hotmail, AOL, Gmail, Plaxo, Yahoo, GMX.net and WEB.de.


This fork is based on cardmagic/contacts and tries to collect all patches which are useful and don't conflict with each other. I try to sync with contacts now and then, if they update. Pull requests welcome!

[jensb] Updates compared to cardmagic/contacts:

  • GMX.de and WEB.de adapters (:gmx, :webde)

  • Updated Yahoo adapter

  • Automatic detection of provider using email / login if the login matches an adapters-specific regex

  • More verbose tests (set DEBUG=1) for debugging

  • Merge with some features of liangzan-contacts.

For automatic detection based on email or login regex, use

Contacts.new(:auto, login, password).contacts

For all providers where it is possible to guess the provider from the login (e.g. where login == email address and the domain is unique), it will automatically set the provider. For all other providers, Contacts.guess(…) will be called, which simply tries to login to all remaining providers in a loop and returns the first success (this might take a while).


Contacts is a universal interface to grab contact list information from various providers including Hotmail, AOL, Gmail, Plaxo, Yahoo, GMX.net, Web.de, inbox.it, sezname.cz.


$ gem install https://github.com/jensb/contacts.git

or on the Gemfile

gem 'contacts', :git => 'https://github.com/jensb/contacts.git'


For a long time, the only way to get a list of contacts from your free online email accounts was with proprietary PHP scripts that would cost you $50. The act of grabbing that list is a simple matter of screen scrapping and this library gives you all the functionality you need. Thanks to the generosity of the highly popular Rails website MOG (mog.com) for allowing this library to be released open-source to the world. It is easy to extend this library to add new free email providers, so please contact the author if you would like to help.


Contacts::Hotmail.new(login, password).contacts # => [[“name”, “foo@bar.com”], [“another name”, “bow@wow.com”]] Contacts::Yahoo.new(login, password).contacts Contacts::Gmail.new(login, password).contacts Contacts.new(:gmail, login, password).contacts Contacts.new(:hotmail, login, password).contacts Contacts.new(:yahoo, login, password).contacts Contacts.guess(login, password).contacts

Notice there are three ways to use this library so that you can limit the use as much as you would like in your particular application. The Contacts.guess method will automatically concatenate all the address book contacts from each of the successful logins in the case that a username password works across multiple services.

Captcha error

If there are too many failed attempts with the gmail login info, Google will raise a captcha response. To integrate the captcha handling, pass in the token and response via:

                    :captcha_token => params[:captcha_token],
                    :captcha_response => params[:captcha_response]).contacts


See the examples/ directory.



This library is released under the terms of the BSD.