I'm doing a small app juggling with calendars and I'd love to send invitations to my user's contacts.
I'm wondering, is there a way (even complicated, I don't mind) which would allow me to know whether a particular contact uses Google Calendar or not, so I could send them plain e-mail invitation or full-featured Google Calendar invitation (which they are familiar with and can respond to them with one click from Gmail)?
- Input: Contact's e-mail address. (e.g.
steve.jobs@apple.com
,my.mom@gmail.com
, ...) - Output: Boolean information "does this contact use Google Calendar?"
- subtask: Boolean information "does this contact even use Google apps?"
It's more or less possible to solve the subtask. Google uses two domains that directly yell at programmer "we are from Google!!!", that's gmail.com
and googlemail.com
(second one used in UK and Germany due to some legal restrictions). In Python, it's this simple:
def uses_google(email):
return email.endswith(('gmail.com', 'googlemail.com'))
Well, then there are Google Apps. Anyone can run them on his own domain. This should (as far as OpenID is properly installed) solve answer to this question: How to detect if an email is a Google Account?
But what about the usage of Google Calendar?
And is it even necessary to solve such problem? What happens if I send invitations to e-mails without any connection to Google Calendar? Something tells me it wouldn't be nice (maybe only notice "Honza sent you invitation, start using Google Calendar if you'd like to respond"). As a user of the Calendar I know when someone sends invitation to me on wrong e-mail, I can't even respond to it.