email validation tools

How to Validate Email Addresses in JavaScript

Check if an email address is correct and really exists using standard javascript and jquery

Checking Formatting

You can easily test if an Email Address is formatted correctly with a regex, like in the example bellow. But it will miss many important cases, like if the email address is well formed but the emails will bounce, because the account never existed or has recently been disabled.

				
					if (/[^@]+@[^@]+\.[^@]+/.test("foo@bar.com")) {
  // email matches the pattern
} else {
  // email doesnt match the pattern
}
				
			

Email Validation API validation

To do full email validation inspecting the mail server you can use MailValidation.io and make a requests call to check it. This will do the check via the real email service which will make sure the requests are not blocked.

				
					var emailAddress = "foo@bar.com"
var apiKey = ???

$.ajax("https://app.mailvalidation.io/a/{team_slug}/validate/api/validate/",
    {
     crossDomain: true,
     type: "POST",
     headers: {
         Authorization: "Api-Key " + apiKey
     },
     body: {
        'email': emailAddress
     }
    })
    .then(function responseHandler(data) {
        if (data.is_valid === 'true') {
            console.log("the email is valid and the mail box is active")
        } else {
            console.log("the email is incorrect or unable to be tested.")
        }
    });
				
			

Support

Are you having trouble, have some questions. How can we help?