fix multiple recipients in smtp plugin - #1732
Conversation
moved splitting of multiple recipient email adresses before sanitization because otherwise it breaks when sanitized.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe SMTP publisher now parses ChangesSMTP recipient handling
Sequence Diagram(s)sequenceDiagram
participant send
participant sanitize_email_content
participant SMTP
send->>send: Parse and validate SMTP_REPORT_TO
send->>sanitize_email_content: Pass recipient list
sanitize_email_content-->>send: Return sanitized recipients
send->>SMTP: Send message using To header
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@front/plugins/_publisher_email/email_smtp.py`:
- Around line 122-125: Update the recipient loop around send_email() so each
iteration passes its current mail_addr as the SMTP envelope recipient instead of
the configured SMTP_REPORT_TO value. Modify both send_email() calls to use a
one-element recipient list containing mail_addr, while preserving the
per-recipient message headers.
- Around line 114-120: Update the recipient handling around to_emails to remove
empty tokens and reject invalid delimiter usage before sanitize_email_content().
Ensure send_email() passes the validated to_emails list, rather than the raw
SMTP_REPORT_TO value, as the recipients argument to smtplib.SMTP.sendmail().
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3014d611-1d13-441b-9230-460a2ab8dab4
📒 Files selected for processing (1)
front/plugins/_publisher_email/email_smtp.py
`smtp_connection.sendmail()` now gets passed the correct recipient. Since `send_email()` is called once for every recipient the correct recipient can be retrieved from `msg` and no additional parameter needs to be passed. - Resolves netalertx#1732 (comment)
removed empty entries in `to_emails` caused i.e. by the input `,` as pointed out in netalertx#1732 (comment) Also added an abort if no entries remain in `to_emails` after this step.
as pointed out in netalertx#1732 (comment)
|
@jokob-sk the remaining issues pointed out by the ai have been resolved. |
|
thanks a lot @etgocode |
Problem
When using multiple email recipients in the smtp plugin separated by

,as suggested in the documentation, no emails are sent because the addresses break in the sanitization step.Fix
I moved the splitting of the addresses in front of the sanitization and modified the sanitization of the recipient adresses to iterate over the provided array.
Summary by CodeRabbit
New Features
Bug Fixes