resilient-mailer-ses
v0.1.5
Published
AWS SES provider implementation for resilient-mailer
Downloads
1
Readme
resilient-mailer-ses
resilient-mailer-ses
implements AWS SES as an email provider for
resilient-mailer
.
var SESProvider = require('resilient-mailer-ses');
var ses = new SESProvider();
var mailer; // ResilientMailer instance
mailer.registerProvider(ses);
Installation
$ npm install resilient-mailer-ses
Usage
Create an instance of the provider. You can also pass in options which are sent on to the AWS SDK:
var SESProvider = require('resilient-mailer-ses');
// see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SES.html#constructor-property
var options = {
accessKeyId: 'accessKey',
secretAccessKey: 'secretKey',
region: 'eu-west-1'
};
var ses = new SESProvider(options);
To register the provider with your ResilientMailer
instance:
var mailer; // ResilientMailer instance
mailer.registerProvider(ses);
In the event that you want to use SESProvider
directly (rather than the
usual way - via ResilientMailer
):
var message = {
from: '[email protected]',
to: ['[email protected]'],
subject: 'Testing my new email provider',
textBody: 'Seems to be working!',
htmlBody: '<p>Seems to be working!</p>'
};
ses.send(message, function (error) {
if (!error)
console.log('Success! The message sent successfully.');
else
console.log('Message sending failed - ' + error.message);
});
To see everything available in the message
object, refer to
resilient-mailer.
Notes
One instance of the provider covers one domain. To send from multiple domains,
you should set up multiple ResilientMailer
instances, with multiple matching
provider instances.
Testing
Install the development dependencies first:
$ npm install
Then the tests:
$ npm test
Support
Please open an issue on this repository.
Authors
- James Billingham [email protected]
License
MIT licensed - see LICENSE file