mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2024-11-10 05:51:07 +07:00
main: set content-type header in transport
This commit is contained in:
parent
7f4c9d2837
commit
09f36a9696
26
main.js
26
main.js
@ -23,15 +23,22 @@ 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,
|
{
|
||||||
port: server_port,
|
host: server_address,
|
||||||
secure: server_port == "465",
|
port: server_port,
|
||||||
auth: {
|
secure: server_port == "465",
|
||||||
user: username,
|
auth: {
|
||||||
pass: password,
|
user: username,
|
||||||
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user