resilient-mailer-ses

0.1.5 • Public • Published

resilient-mailer-ses

resilient-mailer-ses implements AWS SES as an email provider for resilient-mailer.

NPM Version Build Status Coverage Status

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: '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.

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

License

MIT licensed - see LICENSE file

Readme

Keywords

none

Package Sidebar

Install

npm i resilient-mailer-ses

Weekly Downloads

5

Version

0.1.5

License

MIT

Last publish

Collaborators

  • billinghamj