Sovite.Queue.Envelope (sovite v0.6.0)

Copy Markdown View Source

The envelope of a queued message: who sent it, to whom, and how it arrived.

sender is "" for the null reverse-path (MAIL FROM:<>). srs_sender, when set, is the sender to use instead when the message is forwarded to another domain: an SRS address (see Sovite.SRS).

requiretls is set when the client sent REQUIRETLS (RFC 8689): the message may only be relayed over TLS verified with DANE or MTA-STS, to servers that support REQUIRETLS too.

smtputf8 is set when the client sent SMTPUTF8 (RFC 6531): the message may have internationalized addresses and UTF-8 header fields (RFC 6532), and needs a next hop that supports SMTPUTF8 too when it does.

auth_user is the login of the client that submitted the message, if it authenticated, so delivery failures can be traced back to it.

content_filter, when set, is where every recipient's copy goes instead (a transport, such as smtp:[127.0.0.1]:10024): an after-queue content filter, which sends the message back once it has checked it.

notification is set on delivery status notifications Sovite generates itself: :failure, :delay, :success, or :double_bounce (a failed notification reported to the postmaster). A failed :double_bounce is never reported again, so notifications cannot loop.

The DSN parameters (RFC 3461): ret and envid from MAIL, and in dsn the NOTIFY and ORCPT of recipients, by address (also for the aliases in expanded). expanded lists aliases that expanded to several recipients and asked for NOTIFY=SUCCESS: they get an "expanded" notification.

priority is the MT-PRIORITY (RFC 6710), 0 by default. hold is a FUTURERELEASE request (RFC 4865): the message is not delivered before its release time. deliver_by is a DELIVERBY request (RFC 2852): the deadline, and whether to return the message (:return) or notify the sender (:notify) when it passes. rrvs has the RRVS of recipients (RFC 7293), for the next hop to check.

tenant names the customer the message belongs to, on servers that host several. forwarded_from is set on a message another node of a cluster handed over for delivery: the name of that node.

Summary

Types

A DELIVERBY request.

The DSN parameters of one recipient.

t()

Functions

When the message may be delivered: its hold's release time, or nil without one.

Types

deliver_by()

@type deliver_by() :: %{
  deadline: DateTime.t(),
  mode: :return | :notify,
  trace: boolean()
}

A DELIVERBY request.

recipient_dsn()

@type recipient_dsn() :: %{
  notify: Sovite.SMTP.DSNParams.notify() | nil,
  orcpt: Sovite.SMTP.DSNParams.orcpt() | nil
}

The DSN parameters of one recipient.

t()

@type t() :: %Sovite.Queue.Envelope{
  auth_user: String.t() | nil,
  body_type: :"7bit" | :"8bitmime" | :binarymime | nil,
  content_filter: String.t() | nil,
  deliver_by: deliver_by() | nil,
  dsn: %{required(String.t()) => recipient_dsn()},
  envid: String.t() | nil,
  expanded: [String.t()],
  forwarded_from: String.t() | nil,
  helo: String.t() | nil,
  hold: Sovite.SMTP.Params.hold() | nil,
  notification: :failure | :delay | :success | :double_bounce | nil,
  priority: -9..9,
  protocol: String.t() | nil,
  queue_id: String.t(),
  received_at: DateTime.t() | nil,
  recipients: [String.t(), ...],
  remote_ip: :inet.ip_address() | nil,
  requiretls: boolean(),
  ret: Sovite.SMTP.DSNParams.ret() | nil,
  rrvs: %{required(String.t()) => Sovite.SMTP.Params.rrvs()},
  sender: String.t(),
  session_id: String.t() | nil,
  smtputf8: boolean(),
  srs_sender: String.t() | nil,
  tenant: String.t() | nil
}

Functions

release_time(envelope)

@spec release_time(t()) :: DateTime.t() | nil

When the message may be delivered: its hold's release time, or nil without one.