mailgun-validate
v0.1.0
Published
Email validation for node.js using Mailgun's API
Downloads
3
Readme
mailgun-validate
Simple email validation for node.js using Mailgun's API. Performs
- Syntax checks (RFC defined grammar)
- DNS validation
- Spell checks
- Email Service Provider (ESP) specific local-part grammar (if available).
You will need to sign up at mailgun.net for a public API key.
A PHP version is also available here: github.com/kehers/MG_Email.
Installation
npm install mailgun-validate
Use
var Validator = require('mailgun-validate');
var validator = new Validator('mail-gun-pub-key');
validator.validate('[email protected]', function(err, response) {
if (err) {
// Validation error
// Log and fallback to regular expressions
return;
}
/* response = {
"is_valid": true,
"address": "[email protected]",
"parts": {
"display_name": null,
"local_part": "foo",
"domain": "mailgun.net",
},
"did_you_mean": null
}//*/
if (response.is_valid) {
// Email valid
}
else {
// Email invalid
if (response.did_you_mean) {
// Did your mean response.did_you_mean?
}
}
})
Licence
MIT