Chapter 12 — Addressing Addresses 179
chomp($name);
chomp($email);
chomp($notes);
$gmail->add_contact( name => $name, email => $email, notes =>
$notes )
; # simply add contact
print “contact added\n”;
Running this script from the command line provides three prompts, in order, for
the name, e-mail address, and notes regarding the contact. Enter those, and the
script adds the contact to your Gmail account.
If you have a long list of addresses to import, sometimes it’s easier to turn that list
into a comma-separated values (CSV) file and use the import function that’s part
of the Gmail site itself.
A comma-separated values file for e-mail addresses looks like this:
First Name,Last Name,Email Address
Ben,Hammersley,[email protected]
Julius,Caesar,[email protected]
With the first line called the header, defining the values separated by commas
(hence the name) in the rest of the file. Most e-mail programs will export in a
compatible version of CSV anyway, but if you need to make one by hand, that’s
how. Spreadsheets are also good programs to use to build CSV files.
So, to import large amounts of contacts, follow these steps:
1.Create a custom CSV file or export the address book from your other web-
mail provider or e-mail client as a CSV file.
2.Log in to Gmail and click Contacts on the left side of the page. The Contacts
list then opens in a new window.
3.Click Import Contacts.
4.Click Browse and locate the CSV file you’d like to upload.
5.Select the file and click Import Contacts. After successfully uploading the
document, a dialog box displays the number of new entries that were added