mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2024-12-25 18:43:08 +07:00
main: allow two variants of from
This commit is contained in:
parent
b27f0d4766
commit
f00590fc1a
10
main.js
10
main.js
@ -11,6 +11,14 @@ function get_body(body) {
|
||||
return body
|
||||
}
|
||||
|
||||
function get_from(from, username) {
|
||||
if (from.match(/.+<.+@.+>/)) {
|
||||
return from
|
||||
}
|
||||
|
||||
return `"${from}" <${username}>`
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const server_address = core.getInput("server_address", { required: true })
|
||||
@ -34,7 +42,7 @@ async function main() {
|
||||
})
|
||||
|
||||
const info = await transport.sendMail({
|
||||
from: from,
|
||||
from: get_from(from, username),
|
||||
to: to,
|
||||
subject: subject,
|
||||
text: content_type != "text/html" ? get_body(body) : undefined,
|
||||
|
Loading…
Reference in New Issue
Block a user