salix/print/lib/smtp.js

23 lines
506 B
JavaScript

const nodemailer = require('nodemailer');
const config = require('./config.js');
module.exports = {
init() {
if (!this.transporter)
this.transporter = nodemailer.createTransport(config.smtp);
},
send(options) {
options.from = `${config.app.senderName} <${config.app.senderMail}>`;
if (process.env.NODE_ENV !== 'production')
options.to = config.app.senderMail;
return this.transporter.sendMail(options);
},
log() {
},
};