Sovite.SMTP.Params (sovite v0.6.0)

Copy Markdown View Source

Values of the MAIL and RCPT parameters of these SMTP extensions:

  • MT-PRIORITY= (RFC 6710): a priority from -9 to 9.
  • HOLDFOR= and HOLDUNTIL= (FUTURERELEASE, RFC 4865): hold the message for some seconds, or until a time.
  • BY= (DELIVERBY, RFC 2852): deliver within some seconds, or return the message (R) or notify the sender (N).
  • RRVS= (RFC 7293): the recipient's mailbox must have had the same owner since a time; if the next hop cannot check that, return the message (R, the default) or continue (C).

Times are RFC 3339 date-times (2026-10-14T12:00:00Z).

iex> Sovite.SMTP.Params.parse_priority("-3")
{:ok, -3}
iex> Sovite.SMTP.Params.parse_by("120;RT")
{:ok, %{time: 120, mode: :return, trace: true}}
iex> Sovite.SMTP.Params.encode_by(%{time: 98, mode: :return, trace: false})
"98;R"

Summary

Types

BY: seconds left, and what to do when they run out.

HOLDFOR or HOLDUNTIL.

RRVS: the time, and what to do at a next hop without RRVS.

Functions

Encodes a BY value.

Encodes an RRVS value.

Formats a hold as in a DSN's Future-Release-Request: field (RFC 4865 §5).

Formats a time for HOLDUNTIL, RRVS, and the FUTURERELEASE keyword, in UTC.

Parses a BY value: by-time;by-mode[T]. With R, the time must be positive.

Parses a HOLDFOR value: seconds, 1 to 999999999.

Parses a HOLDUNTIL value, an RFC 3339 date-time.

Parses an MT-PRIORITY value: (["-"] NZDIGIT) / "0".

Parses an RRVS value: a date-time without fractions of a second, then ;R or ;C.

The release time of a hold, for a message received at received_at.

Types

by()

@type by() :: %{time: integer(), mode: :return | :notify, trace: boolean()}

BY: seconds left, and what to do when they run out.

hold()

@type hold() :: {:for, pos_integer()} | {:until, DateTime.t()}

HOLDFOR or HOLDUNTIL.

rrvs()

@type rrvs() :: {DateTime.t(), :reject | :continue}

RRVS: the time, and what to do at a next hop without RRVS.

Functions

encode_by(map)

@spec encode_by(by()) :: String.t()

Encodes a BY value.

encode_rrvs(arg)

@spec encode_rrvs(rrvs()) :: String.t()

Encodes an RRVS value.

format_hold(arg)

@spec format_hold(hold()) :: String.t()

Formats a hold as in a DSN's Future-Release-Request: field (RFC 4865 §5).

format_time(time)

@spec format_time(DateTime.t()) :: String.t()

Formats a time for HOLDUNTIL, RRVS, and the FUTURERELEASE keyword, in UTC.

parse_by(value)

@spec parse_by(String.t()) :: {:ok, by()} | :error

Parses a BY value: by-time;by-mode[T]. With R, the time must be positive.

parse_holdfor(value)

@spec parse_holdfor(String.t()) :: {:ok, pos_integer()} | :error

Parses a HOLDFOR value: seconds, 1 to 999999999.

parse_holduntil(value)

@spec parse_holduntil(String.t()) :: {:ok, DateTime.t()} | :error

Parses a HOLDUNTIL value, an RFC 3339 date-time.

parse_priority(arg1)

@spec parse_priority(String.t()) :: {:ok, -9..9} | :error

Parses an MT-PRIORITY value: (["-"] NZDIGIT) / "0".

parse_rrvs(value)

@spec parse_rrvs(String.t()) :: {:ok, rrvs()} | :error

Parses an RRVS value: a date-time without fractions of a second, then ;R or ;C.

release_time(arg, received_at)

@spec release_time(hold(), DateTime.t()) :: DateTime.t()

The release time of a hold, for a message received at received_at.