mirror of
https://github.com/plankanban/planka.git
synced 2025-07-21 22:29:42 +02:00
feat: SMTP integration and email notifications (#631)
This commit is contained in:
parent
60ab09771d
commit
9f0fce098e
14 changed files with 188 additions and 4 deletions
31
server/api/helpers/utils/send-email.js
Normal file
31
server/api/helpers/utils/send-email.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
module.exports = {
|
||||
inputs: {
|
||||
to: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
subject: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
html: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs) {
|
||||
const transporter = sails.hooks.smtp.getTransporter(); // TODO: check if active?
|
||||
|
||||
try {
|
||||
const info = await transporter.sendMail({
|
||||
...inputs,
|
||||
from: sails.config.custom.smtpFrom,
|
||||
});
|
||||
|
||||
sails.log.info('Email sent: %s', info.messageId);
|
||||
} catch (error) {
|
||||
sails.log.error(error);
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue