Process monthly membership reminder bounces against member lists.#39
Merged
Conversation
Site list bounces were previously forwarded to admins without scoring. Register reminder bounces on each subscribed list that sends reminders, while still forwarding owner moderation notices unchanged.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes bounce handling so that bounces generated by monthly membership/password reminders sent from the site list can be scored against the member’s subscribed lists (instead of being forwarded to site admins without processing), while keeping owner-moderation notice forwarding unchanged.
Changes:
- Add detection for “membership reminder” bounces and route them into per-list bounce event registration.
- Add a new config flag (
BOUNCE_PROCESS_REMINDER_BOUNCES) and mark reminder messages withX-Mailman-Membership-Reminder: yes. - Add a targeted unit test module for reminder-bounce detection and queuing behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
tests/test_bounce_reminders.py |
Adds tests for reminder-bounce classification and queuing behavior. |
Mailman/Queue/BounceRunner.py |
Implements reminder-bounce detection and queues reminder bounces against member lists. |
Mailman/Defaults.py.in |
Introduces BOUNCE_PROCESS_REMINDER_BOUNCES default configuration and updates related comments. |
cron/mailpasswds |
Adds a marker header so reminder messages can be reliably identified when they bounce. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+113
to
+126
| runner._bounce_events_fp.seek(0) | ||
| events = [] | ||
| while True: | ||
| try: | ||
| events.append(pickle.load(runner._bounce_events_fp)) | ||
| except EOFError: | ||
| break | ||
| self.assertEqual(len(events), 1) | ||
| self.assertEqual(events[0][0], 'mylist') | ||
| self.assertEqual(events[0][1], 'user@example.com') | ||
| runner._bounce_events_fp.close() | ||
| os.unlink(runner._bounce_events_file) | ||
| runner._bounce_events_fp = None | ||
| runner._bouncecnt = 0 |
Comment on lines
+310
to
+329
| def is_membership_reminder_bounce(msg): | ||
| """Return true if this bounce is for a monthly membership reminder.""" | ||
| for part in typed_subpart_iterator(msg, 'message', 'rfc822'): | ||
| orig = part.get_payload(0) | ||
| if orig is None: | ||
| continue | ||
| if orig.get('X-Mailman-Membership-Reminder', '').lower() == 'yes': | ||
| return True | ||
| if orig.get('x-list-administrivia', '').lower() != 'yes': | ||
| continue | ||
| sender = parseaddr(orig.get('from', ''))[1].lower() | ||
| if not sender: | ||
| continue | ||
| # Owner notifications are sent from the site -bounces address. | ||
| if _is_site_bounces_address(sender): | ||
| continue | ||
| subj = Utils.oneline(orig.get('subject', ''), 'us-ascii').lower() | ||
| if 'reminder' in subj: | ||
| return True | ||
| return False |
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>
Co-authored-by: Copilot Autofix powered by AI <175728472+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.
Site list bounces were previously forwarded to admins without scoring. Register reminder bounces on each subscribed list that sends reminders, while still forwarding owner moderation notices unchanged.