There is no point in trying to work out if an email address is ‘valid’.
A user is far more likely to enter a wrong and valid email address than they are to enter an invalid one.
That’s 27 stabs at the keyboard that could go awry.
Any mistype will result in an invalid email address.[epiphany]Even if the sun shone through my window and I was visited by a particularly savage sneeze (I suffer from Autosomal Dominant Compelling Helio-Ophthalmic Outburst Syndrome*) and I typed out #! ^_`|[email protected] mistake, I would still pass the most thorough email ‘validation’ techniques. ^_`|[email protected] she said she gets super pissed off when told that her email address isn’t valid. For example hitting the neighbouring ‘h’ key instead of ‘g’.
We got chatting and it turns out she only lives a few blocks from me and also collects vintage cameras; we’re playing golf next week. I should probably close these brackets and get on with the story.)So what are the odds that any one typo would result in an invalid email address? From all of the tappable keys on a physical keyboard, there are six characters that, while not completely invalid, are only valid in certain cases: \;, and space. (I know hacking Linked In just to make a point about email validation is a bit extreme, but it is important to back up one’s opinions with data).
Other web forms ask people to enter an email address.
Then they do a quick check to see if what was entered looks at least vaguely like an email address: Unfortunately, some other "email validation" Java Script functions reject perfectly valid email addresses.
In forms when using email ID fields it is a good idea to use client side validation along with your programming language validation.
The following example shows how you can validate an email address for a form.