Kantoor. Routing
(Kantoor v1.0.0)
Which mailbox receives mail for an address.
The order is the one Kantoor.Ingest applies, and the same one Karta's routes
describe: an exact mailbox address; the mailbox behind a +tag
(calvin+news@ when calvin@ exists, as Karta's plus addressing delivers
it); an alias address; the mailbox behind an alias's +tag; then the domain's
catch-all. Anything else is {:error, :unknown_recipient} — with the catch-all
off, unknown addresses never reach Kantoor at all, because Karta refuses them
while the sender is connected (Kantoor.Karta.Routes).
A source is returned beside the mailbox so callers can tell how it was found (the audit log and the tests use it; the message itself always keeps the address it was sent to).
Summary
Functions
Resolves address to {:ok, mailbox, source} or {:error, :unknown_recipient | :domain_disabled}.
The address a +tag belongs to (calvin+news@example.com -> calvin@example.com),
or nil when there is no tag.
Types
Functions
@spec resolve(term()) :: {:ok, Kantoor.Mailboxes.Mailbox.t(), source()} | {:error, :unknown_recipient | :domain_disabled}
Resolves address to {:ok, mailbox, source} or {:error, :unknown_recipient | :domain_disabled}.
The address a +tag belongs to (calvin+news@example.com -> calvin@example.com),
or nil when there is no tag.