Kantoor.Aliases (Kantoor v1.0.0)

Address aliases of a domain: extra addresses that deliver into an existing mailbox (info@example.com into calvin@example.com).

A forwarding-only alias has no mailbox. Its verified destinations and delivery queue are managed by Kantoor.Forwarding; it grants no sending identity.

An alias address is scoped to one domain. Its target may be in another verified domain with the same explicit Karta organisation credential and operator. Its address is normalised like a mailbox address and must not already be a mailbox address (in any domain: two mail domains can never share a full address) nor another alias. Only addresses Karta can route on their own are accepted (Kantoor.Mailboxes.Alias): +tag in an alias would only be reachable through the catch-all.

Deleting an alias also deletes the sending identities that used its address, so nobody keeps sending as an address that no longer exists.

Summary

Functions

Whether a mailbox can receive an alias in this domain.

Creates the alias address in domain delivering into mailbox.

Deletes an alias and the identities that send as its address.

The aliases that deliver into a mailbox.

One alias of the given domain, or nil.

The alias with this address (with its target mailbox), or nil; case-insensitive.

The aliases of a domain, by address.

Converts a forwarding-only alias in place, retaining its address and id. Only a single confirmed destination equal to the selected mailbox is accepted. Queued deliveries must drain first. History is retained with forwarding disabled.

Cross-domain aliases require two active, verified Karta attachments using the same explicit organisation credential and provisioning operator. No inference is made from domain names or external references. Separate credentials fail closed, even when they happen to belong to the same Karta organisation.

Whether the alias and target still permit sending or local delivery.

Types

error()

@type error() ::
  :not_found
  | {:invalid, %{required(atom()) => String.t()}}
  | Ecto.Changeset.t()

Functions

allowed_target(domain, mailbox)

Whether a mailbox can receive an alias in this domain.

create(domain, mailbox, address, note \\ nil)

@spec create(
  Kantoor.Mailboxes.Domain.t(),
  Kantoor.Mailboxes.Mailbox.t() | nil,
  term(),
  term()
) ::
  {:ok, Kantoor.Mailboxes.Alias.t()} | {:error, error()}

Creates the alias address in domain delivering into mailbox.

mailbox: nil is reserved for Kantoor.Forwarding.create_alias/3, which creates the destinations in the same transaction.

{:ok, alias}; {:error, {:invalid, %{field => message}}} when the address is not usable (malformed, not routeable by Karta, already a mailbox or alias); {:error, changeset} from the database.

delete(alias_)

@spec delete(Kantoor.Mailboxes.Alias.t()) :: :ok

Deletes an alias and the identities that send as its address.

for_mailbox(mailbox)

The aliases that deliver into a mailbox.

get(domain, id)

One alias of the given domain, or nil.

get_by_address(address)

@spec get_by_address(term()) :: Kantoor.Mailboxes.Alias.t() | nil

The alias with this address (with its target mailbox), or nil; case-insensitive.

list(domain)

The aliases of a domain, by address.

promote(alias_, mailbox)

Converts a forwarding-only alias in place, retaining its address and id. Only a single confirmed destination equal to the selected mailbox is accepted. Queued deliveries must drain first. History is retained with forwarding disabled.

same_organisation?(left, right)

Cross-domain aliases require two active, verified Karta attachments using the same explicit organisation credential and provisioning operator. No inference is made from domain names or external references. Separate credentials fail closed, even when they happen to belong to the same Karta organisation.

usable?(alias)

Whether the alias and target still permit sending or local delivery.