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:
Fritz Elfert
2026-03-18 16:11:48 +01:00
committed by GitHub
parent 4758fd2f0e
commit d38f3f7cd3

View File

@@ -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