Package Exports
- emailable
- emailable/lib/emailable.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (emailable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Emailable Node Library
This is the official node wrapper for the Emailable API.
Documentation
See the Node API docs.
Installation
Install the package with:
npm install emailable --save
# or
yarn add emailableUsage
The library needs to be configured with your account's API key which is available in your Emailable Dashboard. Require it with your API key:
Setup
// require with api key
var emailable = require('emailable')('live_...')Verification
// verify an email address
emailable.verify('jarrett@emailable.com')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});Slow Email Server Handling
Some email servers are slow to respond. As a result the timeout may be reached before we are able to complete the verification process. If this happens, the verification will continue in the background on our servers. We recommend sleeping for at least one second and trying your request again. Re-requesting the same verification with the same options will not impact your credit allocation within a 5 minute window.
{
message: 'Your request is taking longer than normal. Please send your request again.'
}Batch Verification
Start a batch
var emails = ['jarrett@emailable.com', 'support@emailable.com', ...]
emailable.batches.verify(emails)
.then(function (response) {
console.log(response.id);
});
// you can optionally pass in options like a callback url that we'll POST to when the
// batch is complete.
emailable.batches.verify(emails, { url: 'https://emailable.com/' }).then(function (response) {
console.log(response.id);
});Get the status / results of a batch
Calling batches.status with the batch id will return the batch's status.
This will also return the results once the batch is complete.
var id = '5cfcbfdeede34200693c4319'
emailable.batches.status(id)
.then(function (response) {
console.log(response);
});Development
Run all tests:
$ yarn install
$ yarn testIf you do not have yarn installed, you can get it with npm install --global yarn.
Run a single test suite without a coverage report:
$ yarn test test/verify.spec.jsContributing
Bug reports and pull requests are welcome on GitHub at https://github.com/emailable/emailable-node.