You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
588 B
JavaScript
32 lines
588 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);
|
|
}
|
|
},
|
|
};
|