From f00590fc1a23518cf573e533c1c78001720501ef Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Wed, 25 Mar 2020 16:18:35 +0100 Subject: [PATCH] main: allow two variants of from --- main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 207232d..4ea3b84 100644 --- a/main.js +++ b/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,