BCC copy of outgoing mail never reaches Sent #504
Labels
No labels
Kestra
bug
enhancement
someday
subtask
☁️ api
🎛️ infrastructure
🐞 sentry
📆 2025 Season
📝 pages
allpicks
📝 pages
picks
📝 pages
standings
🚀 performance
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
johnsturgeon/tgfp-web#504
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Outgoing production mail is BCC'd to
MAIL_FROMso a copy lands back in the pool mailbox, where a Fastmail Sieve rule keyed onX-TGFP-Autosave: sentfiles it into Sent. The copies are not arriving.What was ruled out
The application code is correct. Verified against the tree that production was running (2.32.1) and the current release (2.33.0):
_sendsetsbcc=[config.MAIL_FROM]andheaders={"X-TGFP-Autosave": "sent"}on every message, and every sender in the app routes through it — including theEmailQueuedrain, viasend_custom_email.send_messageturns theBccheader into a real envelopeRCPT TOand deletes the header from the transmitted copy (aiosmtplib/email.py:59). It is a genuine delivery, not a header-only ghost.Bcc:andX-TGFP-Autosave: sentare present before handoff to SMTP.So the app hands Fastmail a copy addressed to
john@tgfp.uson every send. The loss is downstream.Likely cause
MAIL_FROMis both the envelope sender and the BCC recipient. If Fastmail is saving submitted mail to Sent on its own, the inbound BCC copy carries the sameMessage-IDas the copy already in Sent and is dropped as a duplicate. That matches the symptom either way it falls out: one copy in Sent that looks like the Sieve rule worked, or none at all, and nothing in Inbox.Unconfirmed — it needs checking in the mailbox, not the repo.
Confirm first
X-TGFP-Autosave: sentpresent means the BCC arrived and the rule fired; absent means that copy is Fastmail's own auto-save and the BCC was dropped.RCPT TO: john@tgfp.uswas accepted.Fix
BCC
TGFP_ADMIN_EMAIL(john@sturgeon.me) rather thanMAIL_FROM. A different mailbox from the sender, so there is no self-dedup and no dependency on the Sieve rule firing at all.One line in
app/mailer.py. Both values already exist in config; no new secret.Worth deciding at the same time: whether the BCC should keep going out from the development server, where it currently reaches the real mailbox regardless of the recipient rewrite added in #501.
This was actually a mistake on the server side (imap server), it's all clear now