Skip to content
Get fast, client-side suggestions for mistyped email addresses
JavaScript CSS CoffeeScript Shell
Branch: master
Clone or download
This branch is 8 commits ahead, 63 commits behind mailcheck:master.

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status

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

What does it do?

When your user types in "user@hotnail.con", Mailcheck will suggest "".

Mailcheck will offer up suggestions for top level domains too, and suggest ".com" when a user types in "user@hotmail.cmo".

At Kicksend, we use Mailcheck to help reduce typos in email addresses during sign ups. It has reduced our sign up confirmation email bounces by 50%.


See it live in action here.


For instant use, download the minified library mailcheck.min.js into your javascripts directory. mailcheck.js is also available unminimised if you want to hack on it, or have your own minimizer.


> bower install --save mailcheck


> npm install --save mailcheck

Usage with jQuery

First, include jQuery and Mailcheck into the page.

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

Have a text field.

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

Now, attach Mailcheck to the text field. You can declare an array of domains and top level domains you want to check against.

var domains = ['', '', ''];
var topLevelDomains = ["com", "net", "org"];

var superStringDistance = function(string1, string2) {
  // a string distance algorithm of your choosing

$('#email').on('blur', function() {
    domains: domains,                       // optional
    topLevelDomains: topLevelDomains,       // optional
    distanceFunction: superStringDistance,  // optional
    threshold: {   // optional
      domain: 1,
      tld: 1
    suggested: function(element, suggestion) {
      // callback code
    empty: function(element) {
      // callback code

Mailcheck takes in two callbacks, suggested and empty. We recommend you supply both.

suggested is called when there's a suggestion. Mailcheck passes in the target element and the suggestion. The suggestion is an object with the following members:

  address: 'test',          // the address; part before the @ sign
  domain: '',    // the suggested domain
  topLevelDomain: 'com',    // the suggested top level domain
  full: ''  // the full suggested email

Mailcheck does not want to get in the way of how you can show suggestions. Use the suggestion object to display suggestions in your preferred manner.

empty is called when there's no suggestion. Mailcheck just passes in the target element. It is a good idea to use this callback to clear an existing suggestion.

Usage without jQuery

Mailcheck is decoupled from jQuery, so its usage without jQuery is almost identical.

Using the example from above, you would call instead.

  email: yourTextInput.value,
  domains: domains,                       // optional
  topLevelDomains: topLevelDomains,       // optional
  distanceFunction: superStringDistance,  // optional
  threshold: {   // optional
    domain: 1,
    tld: 1
  suggested: function(suggestion) {
    // callback code
  empty: function() {
    // callback code

The rest works similarly. In fact, the Mailcheck jQuery plugin just wraps

Usage on Node.js

If you're running this on Node.js, you can just require('mailcheck') to get the mailcheck object, and call run on that:

var mailcheck = require('mailcheck');{
  // see 'usage without jQuery' above.


Mailcheck has inbuilt defaults if the domains or topLevelDomains options aren't provided. We still recommend supplying your own domains based on the distribution of your users.

Adding your own Domains

You can replace Mailcheck's default domain/TLD suggestions by supplying replacements to{
  domains: ['', ''], // replaces existing domains
  topLevelDomains: ['', 'ru'] // replaces existing TLDs

Alternatively, you can extend Mailcheck's global set of default domains & TLDs by adding items to Kicksend.mailcheck.defaultDomains and Kicksend.mailcheck.defaultTopLevelDomains:

Kicksend.mailcheck.defaultDomains.push('', '') // extend existing domains
Kicksend.mailcheck.defaultTopLevelDomains.push('', 'ru') // extend existing TLDs


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. You can modify the inbuilt string distance function, or pass in your own when calling Mailcheck.

Since Mailcheck runs client side, keep in mind file size, memory usage and performance.


Mailcheck is tested with Jasmine. Load spec/spec_runner.html in your browser to run the tests or run npm test from the commandline to test in node.


Let's make Mailcheck awesome. We're on the lookout for maintainers and contributors.

And do send in those pull requests! To get them accepted, please:

  • Test your code. Add test cases to spec/mailcheckSpec.js, and run it across browsers (yes, including IE).
  • Minify the plugin by running grunt in the Mailcheck directory.

Upcoming features, bugs and feature requests are managed in Issues.

Developing on Nitrous.IO

Start contributing to Mailcheck instantly on Nitrous.IO:

Hack kicksend/mailcheck on Nitrous.IO

Who's using Mailcheck?

Do you use Mailcheck? Tweet me your link.

Related Links

Core Team


Licensed under the MIT License.

You can’t perform that action at this time.