fix(email): strip compound channel prefix before SMTP To header - #56581
Open
liuhao1024 wants to merge 2 commits into
Open
liuhao1024 wants to merge 2 commits into
liuhao1024 wants to merge 2 commits into
Conversation
The cron delivery pipeline and session keys sometimes carry a compound channel ID like email:user@example.com. All four SMTP send paths (_send_email, _send_email_with_attachments, _send_email_with_attachment, _standalone_send) used this value directly as the SMTP To header, causing strict servers (Gmail) to reject with 555 5.5.2. Add _strip_channel_prefix() helper and apply it at every SMTP send site. 5 regression tests cover prefix stripping, bare addresses, empty strings, and both the adapter and standalone send paths. Fixes NousResearch#56569
Contributor
Related: fixes #56569 (email adapter using the compound |
13 tasks
Collaborator
|
Thanks for the localized defensive fix. The stated cron/session-key route is not demonstrated against current main. Problems
Suggested changes
Automated hermes-sweeper review. |
9 tasks
This branch has not been deployed
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.
What does this PR do?
Strips the
email:platform prefix from compound channel IDs before using them as the SMTPToheader. When the cron delivery pipeline or session keys carry a compound channel ID likeemail:user@example.com, strict SMTP servers (Gmail) reject the message with555 5.5.2becauseemail:user@example.comis not a valid RFC 5321 address.Related Issue
Fixes #56569
Type of Change
Changes Made
plugins/platforms/email/adapter.py: Added_strip_channel_prefix()helper that strips theemail:prefix from channel identifiers. Applied it in all 4 SMTP send paths:EmailAdapter._send_email()— adapter reply pathEmailAdapter._send_email_with_attachments()— multi-attachment pathEmailAdapter._send_email_with_attachment()— single-attachment path_standalone_send()— standalone/cron delivery pathtests/gateway/test_email.py: AddedTestStripChannelPrefixwith 5 tests covering prefix stripping, bare addresses, empty strings, and both SMTP send paths with compound IDsHow to Test
python -m pytest tests/gateway/test_email.py::TestStripChannelPrefix -xvs— all 5 tests should passpython -m pytest tests/gateway/test_email.py -x— full email test suite (93 tests) should passmsg["To"]receivesuser@example.com(notemail:user@example.com) when a compound channel ID is passed to any SMTP send pathChecklist
Code
fix(scope):)pytest tests/gateway/test_email.py -qand all tests pass (93 passed)Documentation & Housekeeping
cli-config.yaml.example— or N/ACONTRIBUTING.mdorAGENTS.md— or N/AScreenshots / Logs