adejs/utils/mail.js

24 lines
633 B
JavaScript
Raw Normal View History

2018-06-22 11:58:22 +02:00
const log = require('utils/log');
2017-09-23 18:20:56 +02:00
const config = require('settings/config');
const mail = require('emailjs');
module.exports = function(params, callback) {
let server = mail.server.connect({
user: config.MAIL.USERNAME,
password: config.MAIL.PASSWORD,
host: config.MAIL.HOSTNAME,
port: config.MAIL.PORT,
2018-06-22 12:20:33 +02:00
tls: config.MAIL.TLS,
timeout: 30000,
2017-09-23 18:20:56 +02:00
});
2018-06-22 11:58:22 +02:00
server.send(params, function(err) {
if (err === null) {
log.debug("Mail sent successfully");
} else {
log.debug("Error in sending mail " + err);
}
callback();
});
2017-09-23 18:20:56 +02:00
};