Sovite.SMTP.XText (sovite v0.6.0)

Copy Markdown View Source

The xtext encoding of ESMTP parameter values (RFC 3461 §4): + and =, and bytes outside !..~, are written as + and two upper-case hex digits. Used by XCLIENT, XFORWARD, and DSN ORCPT/ENVID.

iex> Sovite.SMTP.XText.encode("a b+c=d")
"a+20b+2Bc+3Dd"
iex> Sovite.SMTP.XText.decode("a+20b+2Bc+3Dd")
{:ok, "a b+c=d"}
iex> Sovite.SMTP.XText.decode("a+2")
:error

Summary

Functions

Decodes xtext. Hex digits may be in either case.

Encodes value as xtext.

Functions

decode(value)

@spec decode(binary()) :: {:ok, binary()} | :error

Decodes xtext. Hex digits may be in either case.

encode(value)

@spec encode(binary()) :: String.t()

Encodes value as xtext.