1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

feat: SMTP integration and email notifications (#631)

This commit is contained in:
Edouard 2024-03-22 00:14:09 +01:00 committed by GitHub
parent 0bb2c71780
commit e14ae09e47
14 changed files with 188 additions and 4 deletions

View file

@ -0,0 +1,35 @@
const nodemailer = require('nodemailer');
module.exports = function smtpServiceHook(sails) {
let transporter = null;
return {
/**
* Runs when this Sails app loads/lifts.
*/
async initialize() {
if (sails.config.custom.smtpHost) {
transporter = nodemailer.createTransport({
pool: true,
host: sails.config.custom.smtpHost,
port: sails.config.custom.smtpPort,
secure: sails.config.custom.smtpSecure,
auth: sails.config.custom.smtpUser && {
user: sails.config.custom.smtpUser,
pass: sails.config.custom.smtpPassword,
},
});
sails.log.info('SMTP hook has been loaded successfully');
}
},
getTransporter() {
return transporter;
},
isActive() {
return transporter !== null;
},
};
};