1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00
planka/server/api/helpers/utils/send-email.js
2024-04-08 01:27:10 +02:00

31 lines
623 B
JavaScript

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); // TODO: provide description text?
}
},
};