mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2024-12-26 11:03:06 +07:00
Add possibility to attach a file to mail
This commit is contained in:
parent
67e2095a53
commit
d4b4fe8144
@ -33,6 +33,9 @@ inputs:
|
|||||||
description: Content-Type HTTP header (text/html or text/plain)
|
description: Content-Type HTTP header (text/html or text/plain)
|
||||||
required: false
|
required: false
|
||||||
default: text/plain
|
default: text/plain
|
||||||
|
attach_file:
|
||||||
|
description: File path that will be added to mail message attachments
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: node12
|
using: node12
|
||||||
main: main.js
|
main: main.js
|
||||||
|
4
main.js
4
main.js
@ -30,6 +30,7 @@ async function main() {
|
|||||||
const to = core.getInput("to", { required: true })
|
const to = core.getInput("to", { required: true })
|
||||||
const from = core.getInput("from", { required: true })
|
const from = core.getInput("from", { required: true })
|
||||||
const content_type = core.getInput("content_type", { required: true })
|
const content_type = core.getInput("content_type", { required: true })
|
||||||
|
const attach_file = core.getInput("attach_file", { required: false })
|
||||||
|
|
||||||
const transport = nodemailer.createTransport({
|
const transport = nodemailer.createTransport({
|
||||||
host: server_address,
|
host: server_address,
|
||||||
@ -47,6 +48,9 @@ async function main() {
|
|||||||
subject: subject,
|
subject: subject,
|
||||||
text: content_type != "text/html" ? get_body(body) : undefined,
|
text: content_type != "text/html" ? get_body(body) : undefined,
|
||||||
html: content_type == "text/html" ? get_body(body) : undefined,
|
html: content_type == "text/html" ? get_body(body) : undefined,
|
||||||
|
attachments: {
|
||||||
|
path: attach_file
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(info)
|
console.log(info)
|
||||||
|
Loading…
Reference in New Issue
Block a user