Collecting Contacts using cardmagic-contacts plug-in in Rails 2.3.8

Collecting Contacts using cardmagic-contacts plug-in in Rails 2.3.8

2 Minutes Read


cardmagic-contacts is a rails plug-in which provides an interface to fetch contact list information from various email providers including Hotmail, AOL, Gmail, Plaxo, Yahoo and many more.

This example narrates how to extract contact list using Rails 2.3.8 and cardmagic-contacts plug-in


  • Download the plug-in by running the command below to store the plug-in in the folder “vendor/plug-ins”


ruby script/plugin install git://


ruby script/plugin


  • Write down the following code on the top of the controller class
require 'contacts'


  • Pass the required gmail/yahoo/hotmail/AOL login & password from view
<div style="margin-left:25px;" >Invite <img src="../images/yahoo.JPG">Yahoo
Friends </div>
<div style="margin-left:25px;">Yahoo Email: <input type="text" name="email"
<div style="margin-left:25px;">Password:   <input type="password"
name="email"  id="yahoo_pwd_id"></div>
<div style="margin-left:122px;margin-top:20px;"><input type="button"
value="Login" name="btn_submit" id="btn_submit" ></div>


  • Create an action to fetch the list of contacts for a specific email id
def grab_contacts
#Grab gmail contacts, password).contacts
#or, login, password).contacts
#Grab yahoo contacts
@yahoo_contacts =, password).contacts
@yahoo_contacts =, login, password).contacts
#Grab hotmail contacts
@hotmail_contacts, password).contacts
@hotmail_contacts =, login, password).contacts


  • Here is also alternate method to get the contacts by providing  email_id and password
any_mail = Contacts.guess(login, password).contacts

The “Contacts.guess” method will automatically concatenate the entire
address book from each of the successful logins. If the login and password is
working with multiple email accounts then it will grab the contacts from all accounts.


  • Display the friends list in your view page
<td >Friends Name</td>
<td >Friends Email</td>
<% @gmail_contacts.each do |contact| %>
<% end %>
Jayadev Das

Do what you do best in – that’s what I’ve always believed in and that’s what I preach. Over the past 25+ years (yup that’s my expertise ‘n’ experience in the Information Technology domain), I’ve been consulting to small, medium and large companies ‘bout Web Technologies, Mobile Future as well as on the good-and-bad of tech. Blogger, International Business Advisor, Web Technology Expert, Sales Guru, Startup Mentor, Insurance Sales Portal Expert & a Tennis Player. And top of all – a complete family man!

No Comments

Post A Comment

Exit pop up

Before You Go...!

Subscribe to Andolasoft Blog

Stay up to date with the latest techniques of web & mobile app development service tips and our SaaS and open source product news.
Holler Box