mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2024-12-26 19:13:06 +07:00
main: use const
This commit is contained in:
parent
8465ba4d6e
commit
7b4177494b
26
main.js
26
main.js
@ -4,8 +4,8 @@ const fs = require("fs")
|
|||||||
|
|
||||||
function get_body(body) {
|
function get_body(body) {
|
||||||
if (body.startsWith("file://")) {
|
if (body.startsWith("file://")) {
|
||||||
body = body.replace("file://", "")
|
const file = body.replace("file://", "")
|
||||||
body = fs.readFileSync(body, "utf8")
|
return fs.readFileSync(file, "utf8")
|
||||||
}
|
}
|
||||||
|
|
||||||
return body
|
return body
|
||||||
@ -13,17 +13,17 @@ function get_body(body) {
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
try {
|
try {
|
||||||
server_address = core.getInput("server_address", { required: true })
|
const server_address = core.getInput("server_address", { required: true })
|
||||||
server_port = core.getInput("server_port", { required: true })
|
const server_port = core.getInput("server_port", { required: true })
|
||||||
username = core.getInput("username", { required: true })
|
const username = core.getInput("username", { required: true })
|
||||||
password = core.getInput("password", { required: true })
|
const password = core.getInput("password", { required: true })
|
||||||
subject = core.getInput("subject", { required: true })
|
const subject = core.getInput("subject", { required: true })
|
||||||
body = core.getInput("body", { required: true })
|
const body = core.getInput("body", { required: true })
|
||||||
to = core.getInput("to", { required: true })
|
const to = core.getInput("to", { required: true })
|
||||||
from = core.getInput("from", { required: true })
|
const from = core.getInput("from", { required: true })
|
||||||
html = core.getInput("html") || "false"
|
const html = core.getInput("html") || "false"
|
||||||
|
|
||||||
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",
|
||||||
@ -33,7 +33,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
info = await transport.sendMail({
|
const info = await transport.sendMail({
|
||||||
from: `"${from}" <${username}>`,
|
from: `"${from}" <${username}>`,
|
||||||
to: to,
|
to: to,
|
||||||
subject: subject,
|
subject: subject,
|
||||||
|
Loading…
Reference in New Issue
Block a user