Repository navigation
feat(sources): route a shared inbox's mail to namespaces with rules - #153
Merged
Merged
Conversation
An email watch can carry routing rules: conditions on sender, recipient (To, Cc, Delivered-To), subject, list or mailbox send matching messages to another namespace, or skip them. No rules: everything goes to the watch's namespace, as before. A preview endpoint shows where the latest messages would go before saving. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V3JT2ET8A1tXFMdidgek2S
Owner
Author
|
Local CI: green. The self-hosted runner is down, so I replayed every PR job from Local CI on PR #153 head 5955265 merged into main f69d6af, 2026-10-05 08:42 UTC
Generated by Claude Code |
4 of 8 tasks
21 of 23 tasks
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.Sugg
2D73
estion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: a watch on an email account sent every new message to one namespace.
After: an email watch can carry routing rules. Each rule has conditions on
from,to(To, Cc, and Delivered-To / X-Original-To, so mail sent to an alias of a shared inbox is told apart),subject,list(List-Id) ormailbox, and sends matching messages to another namespace or skips them. Rules are tried in order and the first match decides. A message no rule matches goes to the watch's own namespace, so with no rules nothing changes.POST /api/v1/watches/routes/previewshows where the latest messages would go before saving.How: the IMAP listing now also reads From, To, Cc, Delivered-To, X-Original-To and List-Id (still headers only, read-only). The new
mail_routes.pychecks and matches rules. Rules are stored on the watch with namespace ids, so a renamed namespace keeps its mail. A rule must name a namespace that exists, because rules never create one. Mail for a namespace deleted later goes to the watch's namespace. Matching is plain string work with no model calls, so it stays light enough for a Raspberry Pi. The web editor comes in a follow-up PR.Motivation and Context
This is the "routing rules from a shared inbox" backlog item.
Types of changes
Checklist:
tests/api/test_mail_routes.py, against the fake IMAP server).docs/accordingly (docs/processing.md).🤖 Generated with Claude Code
https://claude.ai/code/session_01V3JT2ET8A1tXFMdidgek2S
Generated by Claude Code