mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-03-18 22:57:26 +07:00
Relax from check (#277)
* Relax from check - Print a warning instead of an error, if envelope_from is set. - In case of an error, provide a hint about envelope_from. * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
9
main.js
9
main.js
@@ -147,7 +147,14 @@ async function main() {
|
||||
// Either: "Plain Simple Name <user@doma.in>" or just "user@doma.in" (without the <>)
|
||||
let parsed = addressparser(from);
|
||||
if (parsed.length != 1 || parsed[0].address == '') {
|
||||
throw new Error("'from' address is invalid");
|
||||
// Report an error only if the user did not set envelope_from. Otherwise, envelope_from
|
||||
// overrides from anyway and from is used as is (but Nodemailer will remove
|
||||
// the From: header completely).
|
||||
if (envelopeFrom) {
|
||||
core.warning("'from' address is invalid. Nodemailer will not create a 'From:' header.");
|
||||
} else {
|
||||
throw new Error("'from' address is invalid. Maybe you want to set 'envelope_from' to a valid sender address?");
|
||||
}
|
||||
}
|
||||
|
||||
// if neither to, cc or bcc is provided, throw error
|
||||
|
||||
Reference in New Issue
Block a user