Determine if an Email address is Gmail or Hosted Gmail (Google Apps for Your Domain)

For my latest venture, MyFamilio, I needed to know if a user’s Email address is a Gmail one so that I could show the user his/her contacts from Gmail.

Figuring out if the user is on Gmail is usually easy – the Email ends with @gmail.com. But what happens for all of those Google Apps for Your domain (like my own, which uses the @sandler.co.il domain) ?

Well, you can easily detect that by running a DNS query on the MX record.

I wrote a small function in Python which uses dnspyhon to do just that, determine if an Email address is hosted on Gmail or not.

Check the gist here.

Check the gist here.

  • Shanti

    I still don’t understand. I am trying to tell if my client is hosted on GMAIL or elsewhere for her personal domain name. I think she is

  • http://eran.sandler.co.il/ Eran Sandler

    When you say your client do you refer to your Email client software?

  • Guest

    Thanks for sharing it. Haven’t seen this functionality on MyFamilio. Does it still work?