Add envelope-from and envelope-to options (#224)

* Add envelope-from and envelope-to options

* update readme
This commit is contained in:
Shane Krueger 2025-04-08 14:36:45 -04:00 committed by GitHub
parent e04abb1cc1
commit abb4c87fd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View File

@ -64,6 +64,10 @@ Some features:
nodemailerlog: false nodemailerlog: false
# Optional nodemailerdebug: true/false if true lognodem will also be set true # Optional nodemailerdebug: true/false if true lognodem will also be set true
nodemailerdebug: false nodemailerdebug: false
# Optional custom SMTP MAIL FROM address (overrides username):
envelope_from: mailer@example.com
# Optional custom SMTP RCPT TO addresses (overrides to, cc, bcc):
envelope_to: mailer@example.com,admin@example.com
``` ```
## Troubleshooting ## Troubleshooting

View File

@ -63,6 +63,12 @@ inputs:
nodemailerdebug: nodemailerdebug:
description: Debug option for nodemailer description: Debug option for nodemailer
required: false required: false
envelope_from:
description: Custom envelope sender address for SMTP MAIL FROM command
required: false
envelope_to:
description: Custom envelope recipient addresses for SMTP RCPT TO command (separated with comma)
required: false
runs: runs:
using: node20 using: node20
main: main.js main: main.js

View File

@ -99,6 +99,8 @@ async function main() {
const priority = core.getInput("priority", { required: false }) const priority = core.getInput("priority", { required: false })
const nodemailerlog = core.getInput("nodemailerlog", { required: false }) const nodemailerlog = core.getInput("nodemailerlog", { required: false })
const nodemailerdebug = core.getInput("nodemailerdebug", { required: false }) const nodemailerdebug = core.getInput("nodemailerdebug", { required: false })
const envelopeFrom = core.getInput("envelope_from", { required: false })
const envelopeTo = core.getInput("envelope_to", { required: false })
// if neither to, cc or bcc is provided, throw error // if neither to, cc or bcc is provided, throw error
if (!to && !cc && !bcc) { if (!to && !cc && !bcc) {
@ -140,6 +142,10 @@ async function main() {
html: htmlBody ? getText(htmlBody, convertMarkdown) : undefined, html: htmlBody ? getText(htmlBody, convertMarkdown) : undefined,
priority: priority ? priority : undefined, priority: priority ? priority : undefined,
attachments: attachments ? (await getAttachments(attachments)) : undefined, attachments: attachments ? (await getAttachments(attachments)) : undefined,
envelope: (envelopeFrom || envelopeTo) ? {
from: envelopeFrom ? envelopeFrom : undefined,
to: envelopeTo ? envelopeTo : undefined
} : undefined
}); });
break; break;
} catch (error) { } catch (error) {