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:
parent
0bb2c71780
commit
e14ae09e47
14 changed files with 188 additions and 4 deletions
35
server/api/hooks/smtp/index.js
Normal file
35
server/api/hooks/smtp/index.js
Normal 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;
|
||||
},
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue