This one checks to make sure my Gmail Contacts’ names are spelt how the contact spells them.

It looks at emails sent from the contact, and compares the sender name with the name on file for that contact.

import libgmail # http://libgmail.sourceforge.net/

ga = libgmail.GmailAccount("email@gmail.com", "password")
ga.login()
all_contacts = ga.getContacts().getAllContacts()

def test_thread(thread, contact):
    for message in thread:
        if message.sender.lower() != contact.email.lower():
            continue
        if '@' in message.author_fullname:
            continue
        if message.author_fullname == contact.name:
            return True
        else:
            print "\t", message.author_fullname, "->", contact.name
            return True

for contact in all_contacts:
    results = ga.getMessagesByQuery("from: %s -is:chat" % contact.email)
    if not results:
        print "%s -------No Email" % contact.email
        continue
    for thread in results:
        result = test_thread(thread, contact)
        if result:
            break
    else:
        print "%s -------No Good Email" % contact.email
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s