email-validation

How to find typos like yaho.com, gnail.com... when having people fill in email addresses


In all projects with online forms where lots of people have to enter their data, a surprisingly large number enters email addresses that pass the regex validation but look like foo@yaho.com, foo@gnail.com or foo@hotmial.com - typos in the domain names of well known email providers.

We would love to show a hint like "you wrote foo@yaho.com, but didn't you mean foo@yahoo.com?".

Of course we could create a huge collection of likely spelling errors.

Is there a more elegant way? A webservice that does just that? A code snippet? A super cool regex?


Solution

  • There's a very nice script that does what you need: mailcheck.js

    "The Javascript library and jQuery plugin that suggests a right domain when your users misspell it in an email address."

    You can try a mailcheck working demo here.