mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-03-05 11:29:25 +07:00
Add support for custom email headers via JSON input (#264)
* Adding custom header with JSON support * Adding headers in test workflow --------- Co-authored-by: W506810_wexinc <spiros.kalogeropoulos@wexinc.com>
This commit is contained in:
committed by
GitHub
parent
7c60f8f904
commit
ba302ba66e
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -46,6 +46,7 @@ jobs:
|
||||
convert_markdown: true
|
||||
attachments: package.json,action.yml
|
||||
priority: high
|
||||
headers: '{"X-My-Test-Header": "Passed"}'
|
||||
|
||||
- name: Get mail
|
||||
run: |
|
||||
|
||||
@@ -63,6 +63,8 @@ Some features:
|
||||
attachments: attachments.zip,git.diff,./dist/static/*.js
|
||||
# Optional priority: 'high', 'normal' (default) or 'low'
|
||||
priority: low
|
||||
# Optional custom headers:
|
||||
headers: '{"X-Priority": "3 (Normal)", "X-My-Header": "MyValue"}'
|
||||
# Optional nodemailerlog: true/false
|
||||
nodemailerlog: false
|
||||
# Optional nodemailerdebug: true/false if true lognodem will also be set true
|
||||
|
||||
@@ -57,6 +57,9 @@ inputs:
|
||||
priority:
|
||||
description: Set Priority level for the mail message to 'high', 'normal' (default) or 'low'
|
||||
required: false
|
||||
headers:
|
||||
description: 'Custom headers for the mail message as a JSON string (e.g., {"X-Custom-Header": "value"})'
|
||||
required: false
|
||||
nodemailerlog:
|
||||
description: Log option for nodemailer
|
||||
required: false
|
||||
|
||||
2
main.js
2
main.js
@@ -115,6 +115,7 @@ async function main() {
|
||||
required: false,
|
||||
});
|
||||
const envelopeTo = core.getInput("envelope_to", { required: false });
|
||||
const headers = core.getInput("headers", { required: false });
|
||||
|
||||
// if neither to, cc or bcc is provided, throw error
|
||||
if (!to && !cc && !bcc) {
|
||||
@@ -166,6 +167,7 @@ async function main() {
|
||||
? getText(htmlBody, convertMarkdown)
|
||||
: undefined,
|
||||
priority: priority ? priority : undefined,
|
||||
headers: headers ? JSON.parse(headers) : undefined,
|
||||
attachments: attachments
|
||||
? await getAttachments(attachments)
|
||||
: undefined,
|
||||
|
||||
Reference in New Issue
Block a user