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);$ npm install resilient-mailer-sesCreate 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: 'no-reply@example.com',
to: ['user@example.net'],
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.
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.
Install the development dependencies first:
$ npm installThen the tests:
$ npm testPlease open an issue on this repository.
- James Billingham james@jamesbillingham.com
MIT licensed - see LICENSE file