main: set content-type header in transport

This commit is contained in:
Dawid Dziurla 2020-03-24 13:59:57 +01:00
parent 7f4c9d2837
commit 09f36a9696
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

14
main.js
View File

@ -23,7 +23,8 @@ async function main() {
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 transport = nodemailer.createTransport({ const transport = nodemailer.createTransport(
{
host: server_address, host: server_address,
port: server_port, port: server_port,
secure: server_port == "465", secure: server_port == "465",
@ -31,7 +32,13 @@ async function main() {
user: username, user: username,
pass: password, pass: password,
} }
}) },
{
headers: {
"Content-Type": content_type
}
}
)
const info = await transport.sendMail({ const info = await transport.sendMail({
from: `"${from}" <${username}>`, from: `"${from}" <${username}>`,
@ -39,9 +46,6 @@ 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,
headers: {
"Content-Type": content_type
}
}) })
console.log(info) console.log(info)