mailgun-validator
v0.0.2
Published
Validate email address using Mailgun's APIs
Downloads
2
Readme
mailgun-validator
Install
npm install mailgun-validator
API
var mgval = require('mailgun-validator')('<PUBLIC_APIKEY>')
Validator.validate(address:String, cb:Function)
Validates the given `address
Examples:
mgval.validate('[email protected]', function(err, res) {
if (err) {
throw err
} else {
console.log(res)
}
})
Returns:
{
is_valid: true,
parts: {
local_part: 'john.smith',
domain: 'gmail.com',
display_name: ''
},
address: '[email protected]',
did_you_mean: null
}
Validator.parse(addresses:String|Array, syntaxOnly:Boolean, cb:Function)
Parses the given addresses
Example:
mgval.parse(['[email protected]', '[email protected]'], function(err, res) {
if (err) {
throw err
} else {
console.log(res)
}
})
Returns:
{
parsed: [
'[email protected]',
'[email protected]'
],
unparseable: []
}
Example:
mgval.parse(['[email protected]', '[email protected]'], false, function(err, res) {
if (err) {
throw err
} else {
console.log(res)
}
})
Returns:
{
parsed: [
'[email protected]'
],
unparseable: [
'[email protected]'
]
}