Prevent Bogus Email Domains with jQuery Mailcheck

2012-05-16 Ajax & Jquery

A common technique to avoid email typos in registration form is to have the user input their email in twice and verify. But who cares how much checking fields do we have in registration form? Even if we place 4 “re-type your email”, people will copy and paste data from one filled input to others. As a result, this extra checking process fails. People need another way to check what exactly they have typed in email fields.
From this point I want to recommend an additional thing to help your users (if you use any kind of registration forms) sign up quicker and still proactively catch email typos in email domain names. It’s Mailcheck – jQuery plugin that suggests a right domain when your users misspell it in an email address.

Prevent Bogus Email Domains with Mailcheck

What does it do? When your user types in “user@hotnail.con“, Mailcheck will suggest “user@user@hotmail.com“.
It helps reduce typos in email addresses during sign ups, and can prevent up to 50% of confirmation email bounces.

Usage
First, include jQuery and Mailcheck into the page.

<script src="jquery.min.js"></script>
<script src="jquery.mailcheck.min.js"></script>

Have a text field.

<input id="email" name="email" type="text" />

Now, attach Mailcheck to the text field. Remember to declare an array of domains you want to check against.

<script>
var domains = ['hotmail.com', 'gmail.com', 'aol.com'];
$('#email').on('blur', function() {
  $(this).mailcheck({
    domains: domains,   // optional
    suggested: function(element, suggestion) {
      // callback code
    },
    empty: function(element) {
      // callback code
    }
  });
});
</script>

Mailcheck takes in two callbacks, suggested and empty. You can use the callbacks to display the appropriate visual feedback to the user.

Domains
The Mailcheck jQuery plugin defaults to a list of top email domains if the domain option isn’t provided. We still recommend supplying your own domains based on the distribution of your users.

The included default domains are: yahoo.com, google.com, hotmail.com, gmail.com, me.com, aol.com, mac.com, live.com, comcast.net, googlemail.com, msn.com, hotmail.co.uk, yahoo.co.uk, facebook.com, verizon.net, sbcglobal.net, att.net, gmx.com, and mail.com.

Customization
The Mailcheck jQuery plugin wraps Kicksend.mailcheck. The prime candidates for customization are the methods Kicksend.mailcheck.findClosestDomain and Kicksend.mailcheck.stringDistance.

Mailcheck currently uses the sift3 string similarity algorithm by Siderite. Since Mailcheck runs client side, keep in mind file size, memory usage, and performance.

Download jQuery Mailcheck
Share diamonds
Comments
Javascript is disabled on your browser. You can't send comments without JavaScript.