Skip to content

Commit

Permalink
feat: add headers option
Browse files Browse the repository at this point in the history
  • Loading branch information
DominusKelvin committed Nov 20, 2024
1 parent 7136a62 commit b1c6e77
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lib/private/mail/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ module.exports = {
'Comma separated list or an array of recipients email addresses that will appear on the Bcc: field',
defaultsTo: []
},
headers: {
type: 'ref',
description: 'An object of additional headers to include in the email.',
default: {}
},
// Resend transport specific options
react: {
type: 'string',
Expand All @@ -155,25 +160,30 @@ module.exports = {
},

fn: async function ({
mailer,
template,
templateData,
layout,
to,
subject,
mailer,
from: fromAddress,
fromName,
replyTo,
text,
attachments,
// SMTP and Resend transport specific options
replyTo,
cc,
bcc,
attachments,
headers,
// Mailtrap transport specific options
templateUuid,
templateVariables,
category,
customVariables,
testInboxId
testInboxId,
// Resend transport specific options
react,
scheduledAt
}) {
if (template && !template.startsWith('email-')) {
sails.log.warn(
Expand Down Expand Up @@ -262,7 +272,8 @@ module.exports = {
cc,
bcc,
replyTo,
attachments
attachments,
headers
}
const smtpInfo = await transporter.sendMail({ ...smtpMail })
sails.log.debug('Email sent: %s', smtpInfo.messageId)
Expand Down Expand Up @@ -321,7 +332,8 @@ module.exports = {
bcc,
attachments,
react,
scheduledAt
scheduledAt,
headers
}
const resendInfo = await resend.emails.send({ ...resendMail })
sails.log.debug('Email sent: %s', resendInfo.id)
Expand Down

0 comments on commit b1c6e77

Please sign in to comment.