Add support for separate mailboxes #718
Conversation
|
-1 Let's not overcomplicate things. One could just use multiple Mailpit instances. |
@D-i-t-gh The cases I had in mind where a single instance helps:
That said, it's entirely your call whether that's worth the extra surface area. |
|
@sajanlamsal Thanks for your contribution. Given the size of this PR, and the fact that it appears to be completely AI-generated (please confirm), I will need some time to assess it and decide whether it aligns with Mailpit's goals and existing functionality. I briefly glanced through the code and found some untested & theoretical holes in the logic, but I don't want to speculate until I can actually review it properly - for while I need dedicated time given the about of code and the potential impact of any structural change. |
|
Thank you for taking the time for the comment and quick walk through. To answer your question directly: However, most of the code (Frontend Part), tests, and documentation were written by AI. Also regarding your concern for the gaps, I would very much appreciate your specfiics whenever you have the chance. Thank you for engaging with it thoughtfully. |
Summary
Adds separate mailboxes: when SMTP authentication is enabled, each authenticated
username can be viewed as its own switchable mailbox in the web UI. Mailpit already
records the authenticated username on every message — this surfaces it as a first-class,
filterable view, with no database schema change.
Motivation
Several services can already share one Mailpit instance by authenticating with different
SMTP usernames, but there was no way to view mail grouped by service — everything landed
in one combined inbox. This lets you switch between per-service mailboxes.
What's included
Web UI
All mail./mailbox/<username>route/view with a clean URL and an empty search bar.and searches apply within the current mailbox; opening a message and returning keeps
the mailbox; live updates are filtered to the mailbox.
API / backend
username:<name>search filter (exact match; supports-username:exclusion),composable with existing filters (
tag:,subject:, …).usernamesarray added to the/api/v1/messagesand/api/v1/searchresponses(additive, mirrors
tags);swagger.jsonupdated.GET /mailbox/{username}serves the SPA so direct loads / reloads work.No breaking changes
Usernamealready stored in message metadata.--tags-username(username auto-tagging); the two can be used together.Testing
TestUsernameSearchandTestGetAllUsernames(run across all tenant modes).gofmt -s,go vet, the Go test suite, andnpm run lint(eslint + prettier) all pass.composition within a mailbox, live updates, and message back-navigation.
Docs
Companion documentation PR: axllent/mailpit-website#26