Reputation: 29
How can I verify if a given gmail address is valid or not?
I'm not asking for a script to check validation nor any regular expression. I only need to know if a person put a valid gmail address in a verify box. Some code which checks Google's database to see if it is a valid gmail address. The same as when we register a new gmail address and it shows a message saying the gmail address already exists. If it is possible to do so with some Google API for Java? I would like to use it in GAE.
Upvotes: 2
Views: 2978
Reputation: 120486
If a person puts a gmail address in a "verify" text-box then what code can I use to check google's database and tell me whether this is a valid ID?
I hope there is no way because gmail should not go out of their way to make it easy to harvest lists of email addresses to spam:
A Directory Harvest Attack or DHA is a technique used by spammers in an attempt to find valid/existent e-mail addresses at a domain by using brute force. The attack is usually carried out by way of a standard dictionary attack, where valid e-mail addresses are found by brute force guessing valid e-mail addresses at a domain using different permutations of common usernames. These attacks are more effective for finding e-mail addresses of companies since they are likely to have a standard format for official e-mail aliases (i.e. [email protected], [email protected], or [email protected]).
Any API that lets you tell whether a string is a gmail address that points to a live account would simply make it easier for spammers to spam that user.
If not then what are secure way to validate?
Send them an email with a URL that they can click to confirm that they own the email address.
The link should contain a nonce that you store in a database with the email addy or some information you've signed so you know it came from you.
This kinds of account verification is pretty standard.
Upvotes: 4