engined-mailer-aws
v0.0.3
Published
Local mailer use aws backend for engined.
Downloads
1
Readme
engined-mailer-gmail
Local mailer use aws backend for engined.
Installation
Install via NPM:
npm install engined-mailer-aws
Usage
Start engined-mailer-aws service in engined, see example below:
const { Manager } = require('engined');
const MailerService = require('engined-mailer');
const LocalMailerService = require('engined-mailer-aws');
const mailer = MailerService();
const localMailer = LocalMailerService({
accessKeyId: config.get('mailer').ses.accessKeyId,
secretAccessKey: config.get('mailer').ses.secretAccessKey,
region: config.get('mailer').ses.region
});
const main = async () => {
// Create manager
let serviceManager = new Manager({ verbose: true });
// Adding service to manager
serviceManager.add('Mailer', mailer);
serviceManager.add('LocalMailer', localMailer);
// Start all services
await serviceManager.startAll();
};
main();
Send email with local mailer backend
The example to show how to send email with local mailer backend:
// Using local mailer backend
let localAgent = this.getContext().get('Mailer').getAgent('default');
// Send Email
localAgent.sendMail({
from: config.get('mailer').sender.name + ' <' + config.get('mailer').sender.address + '>',
to: '[email protected]',
subject: 'test',
html: '<p>1234</p>'
})
License
Licensed under the MIT License
Authors
Copyright(c) 2017 Leon Lin(林為志) <[email protected]>