Inbox domains & mailboxes
Root vs custom domains, tags, and how mailbox resolution works.
This system supports both a shared root domain and per‑team custom domains.
Domain layout
- Root inbound domain is set via
INBOX_ROOT_DOMAIN(API) andEMAIL_DOMAIN(worker). - Custom domain is stored in
teamInboxSettings.domain. - Each organisation may also use a subdomain under the root (for example
company1.in.plop.email).
Mailbox resolution rules
Loading diagram...
-
Custom domain configured
apps/apiresolves the team byteamInboxSettings.domain = <domain>.- If a mailbox doesn't exist for the team, it is created on first inbound message.
-
No custom domain
- If the inbound domain matches
INBOX_ROOT_DOMAIN, the API looks up the mailbox by{ domain: root, name: mailbox }. - If no mailbox exists for the root domain, the webhook returns 404.
- If the inbound domain matches
-
Unknown non‑root domain
- If the domain is not the root and there's no
teamInboxSettingsmatch, the webhook returns 404.
- If the domain is not the root and there's no
Tags and mailbox names
support+billing@...stores the message under mailboxsupportwith tagbilling.mailboxWithTagis preserved as the full local‑part (support+billing).- Tags are lower‑cased and searchable via the Messages API.
Mailbox names are always normalized to lowercase. Keep mailbox naming consistent in test fixtures and docs.