Repository navigation
Conversation
…gle bounce In the chatter the "To:" line (the MessageTracking template) marked a red error on EVERY recipient when a message went to several and only ONE bounced, and showed 'unknown' for recipients without a tracking record -- even though core's own envelope icon showed the right per-recipient status. mail.tracking.email tracks per SMTP send, not per recipient, so a bounce (soft-bounced/bounced) is shared by the co-recipients' trackings and mail.message.tracking_status() returns status='error' for recipients that were actually delivered; recipients with no tracking fall to 'unknown'. Reconcile the per-send tracking status against the core mail.notification, which is per recipient and reliable: core 'sent' downgrades a tracking error/unknown to 'sent'; core 'bounce'/'exception' upgrades a tracking sent/unknown/waiting to 'error'. 'delivered'/'opened' (tracking-pixel info the core does not have) are left untouched. Real case: a message to four recipients where one address did not exist (550 User unknown) showed all four as error; after the fix only the real bounce is error and the other three are sent.
skanndar
force-pushed
the
19.0-fix-mail_tracking-corecipient-bounce
branch
from
October 7, 2026 14:44
6079aa8 to
0b400fa
Compare
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.
Problem
In the chatter, the "To:" line (the
MessageTrackingtemplate added bymail_tracking) marks a red ✖ error on every recipient when a message goes to several and only one bounces — as if nobody received it. Recipients without a tracking record showunknown. Core's own envelope icon /MessageNotificationPopovershow the correct per-recipient status; only themail_trackingline is wrong.Root cause
mail.tracking.emailtracks per SMTP send, not per recipient. When a message goes to several recipients and the DSN of one bounces, the bounce state (soft-bounced/bounced) is shared by the co-recipients'mail.tracking.email, somail.message.tracking_status()returnsstatus='error'for recipients that were actually delivered; recipients with no tracking fall to'unknown'.Fix
The core
mail.notificationis per recipient and reliable, so reconcile the per-send tracking status against it at the end oftracking_status():sent+ trackingerror/unknown→sentbounce/exception+ trackingsent/unknown/waiting→errordelivered/opened(tracking-pixel info the core doesn't have) are left untouched.Tests / reproduction
Regression test (
test_corecipient_bounce.py) builds the real case: a message to four recipients, one really bounced (corebounce+ trackingsoft-bounced), two delivered but sharing thesoft-bouncedtracking, one delivered with no tracking. Verified A/B onodoo:19: before → all fourerror/unknown; after → only the real bounce iserror, the other threesent.Real-world sighting: a message to four recipients where one address did not exist (
550 5.1.1 User unknown) showed all four as ✖.