/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package contacts;

/**
 *
 * @author srikantha
 */
import com.xdatasystem.contactsimporter.*;
import com.xdatasystem.user.Contact;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class InboxReader {

	public static void main(String args[]) {
            StringBuffer sb=null;
        try {
            ContactListImporter importer = ContactListImporterFactory.gmail("username", "password");
            List<Contact> contacts = importer.getContactList();
            sb = new StringBuffer();
            sb.append("<address>");
            for (int i = 0; i < contacts.size(); i++) {
                Contact contact = contacts.get(i);
                sb.append("<address1 email=\""+contact.getEmailAddress()+"\"/>");
            }
            sb.append("</address>");
            System.out.println(sb.toString());
           } catch (ContactListImporterException ex) {
            Logger.getLogger(InboxReader.class.getName()).log(Level.SEVERE, null, ex);
        }



	}

}

