Fix: add SMTP helpers and fallback to domain:587 #7
Loading…
Reference in a new issue
No description provided.
Delete branch "jch/fix-smtp-fallback-localhost"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's changed
This commit adds the missing
_has_starttls()and_has_auth()helper functions that were referenced but never defined (causing NameError when merged). It also implements a robust SMTP fallback mechanism for thesend_emailmethod.Fix 1: Undefined helpers
_has_starttls()and_has_auth()NameError: name '_has_starttls' is not definedwhen attempting to send emailsFix 2: Fallback SMTP to domain:587 with STARTTLS + Auth
When the primary SMTP connection fails (e.g., localhost:25 rejecting unauthenticated sender), the bridge now tries a fallback:
<domain>:587users.conf.json(credentials['jid']andcredentials['password'])This fixes the issue where Postfix on localhost:25 rejects email senders not locally logged in, but allows the bridge to authenticate with STARTTLS+AUTH on port 587.
Technical details:
SMTPException(not broad Exception)if not primary_failed: return)fb = Noneinitialized before try block prevents NameError in finally clauseHow to test