Address rewriting.
Rewrites
The address rewrites in the database (sovitectl rewrite) change
sender addresses (kind sender), recipient addresses (recipient), or
both. A rewrite for the specific kind wins over one for both; only one
applies to an address. Keys tried (see Sovite.Core.Routing.lookup/4):
user+ext@domain, user@domain, the bare local part for hosted
domains, then @domain. Replacements:
new@example.net- replaces the address. An extension the pattern did not match is kept: withalice@example.com -> new@example.net,alice+x@example.combecomesnew+x@example.net.@example.net- replaces only the domain.new- replaces only the local part.
Hiding subdomains
routing.hide_subdomains hides host names in sender addresses: with
["example.com"], alice@host.example.com becomes
alice@example.com. An entry !sub.example.com keeps that domain and
its subdomains as they are; entries are tried in order. Local parts in
routing.hide_subdomains_exceptions (such as root) are never
changed. This applies to the envelope sender and to the addresses in
the header.
Header addresses
With routing.rewrite_headers (the default), the addresses in From:,
Sender:, Reply-To:, Resent-From:, and Resent-Sender: are
rewritten like the sender, and those in To:, Cc:, Bcc:,
Resent-To:, Resent-Cc:, and Resent-Bcc: like recipients, but only
in mail from trusted networks and authenticated clients: Sovite does
not change the header of mail from the internet.
Summary
Functions
Rewrites the addresses in header fields (Sovite.Message.Headers
fields). A table that cannot be read leaves the address as it was.
Hides the subdomain in address, see the module documentation.
Rewrites an envelope recipient with the address rewrites.
Whether anything would change header addresses.
Rewrites an envelope sender: the address rewrites, then hiding
subdomains. The null sender stays null. Returns {:error, table} when
a table cannot be read.
Functions
@spec header_fields(Sovite.Core.Routing.t(), [Sovite.Message.Headers.field()]) :: [ Sovite.Message.Headers.field() ]
Rewrites the addresses in header fields (Sovite.Message.Headers
fields). A table that cannot be read leaves the address as it was.
@spec hide_subdomains(Sovite.Core.Routing.t(), String.t()) :: String.t()
Hides the subdomain in address, see the module documentation.
@spec recipient(Sovite.Core.Routing.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
Rewrites an envelope recipient with the address rewrites.
@spec rewrites_headers?(Sovite.Core.Routing.t()) :: boolean()
Whether anything would change header addresses.
@spec sender(Sovite.Core.Routing.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
Rewrites an envelope sender: the address rewrites, then hiding
subdomains. The null sender stays null. Returns {:error, table} when
a table cannot be read.