Mailcheck.js is a 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 “user@hotmail.com”.
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%.
1. INCLUDE JS FILES
<script src="jquery.min.js"></script>
<script src="mailcheck.min.js"></script>
2. HTML
<input id="email" name="email" type="email" />
3. JAVASCRIPT
var domains = ['hotmail.com', 'gmail.com', 'aol.com'];
var topLevelDomains = ["com", "net", "org"];
var superStringDistance = function(string1, string2)
// a string distance algorithm of your choosing
$('#email').on('blur', function()
$(this).mailcheck(
domains: domains, // optional
topLevelDomains: topLevelDomains, // optional
distanceFunction: superStringDistance, // optional
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: 'hotmail.com', // the suggested domain
topLevelDomain: 'com', // the suggested top level domain
full: 'test@hotmail.com' // 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.
Mailcheck.js - Reduce user-misspelled email addresses
No comments:
Post a Comment