25 lines
663 B
JavaScript
25 lines
663 B
JavaScript
const log = require('utils/log');
|
|
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,
|
|
tls: config.MAIL.TLS,
|
|
ssl: config.MAIL.SSL,
|
|
timeout: 30000,
|
|
});
|
|
|
|
server.send(params, function(err) {
|
|
if (err === null) {
|
|
log.debug("Mail sent successfully");
|
|
} else {
|
|
log.debug("Error in sending mail " + err);
|
|
}
|
|
callback();
|
|
});
|
|
};
|