Prefer SMTP_SERVER over local mail command for email reports - #21
Merged
Conversation
… command If SMTP_SERVER is explicitly configured, send the report directly via curl instead of the local 'mail' command. Previously 'mail' was always tried first and only fell back to SMTP if 'mail' was missing entirely, so a misconfigured local MTA (e.g. msmtp CRAM-MD5 auth failures) would block delivery even when a working SMTP relay was configured. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a case reported after merging #20: on a server with a local
mailcommand configured via
msmtp, authentication was failing (CRAM-MD5rejected by the relay), even though the user had also configured
SMTP_SERVER/SMTP_AUTH_USER/etc. for this script's SMTP fallback.Root cause:
send_email_reportalways tried the localmailcommandfirst and only used the SMTP/curl path if
mailwas missing entirely — soa misconfigured local MTA blocked delivery even with a working relay
configured explicitly for this script.
Change
If
SMTP_SERVERis set, send directly viacurl(bypassingmailentirely). Otherwise fall back to the local
mailcommand as before.Testing
shellcheckclean (pre-existing intentional-glob info only).mail(forced failure) andcurlto confirmSMTP_SERVERnow takes priority and
mailis never invoked when it's set.