@transomjs/transom-smtp
v3.0.0
Published
Add SMTP functions and email templating to server-side Transom code
Downloads
6
Readme
transom-smtp
Add simple to use SMTP messaging functions to your server-side Transomjs code.
Installation
$ npm install --save @transomjs/transom-smtp
Usage
options.smtp
options.smtp is passed in directly to nodemailer.createTransport() and follows the nodemailer configuration.
options.helpers
options.helpers adds methods to send email from specific addresses. The following example puts "sendFromNoreply()" and "sendFromAdmin()" methods on the transomSmtp Object.
NOTE: a sendFromNoreply() method is required when using transomSmtp with the transom-mongoose-localuser.
const Transom = require('@transomjs/transom-core');
const transomSmtp = require('@transomjs/transom-smtp');
const transom = new Transom();
const options = {
smtp: {
host: 'smtp.example.com',
port: 587,
secure: false,
auth: {
user: 'username',
pass: 'password'
}
},
helpers: {
noreply: '"No Replies" [email protected]',
admin: '[email protected]'
}
};
transom.configure(transomSmtp, options);
transom.initialize(server, myApi).then(function(server){
...
});