Karta. Mail. ReceivedHeader
(Karta v1.0.0)
The Received: trace field Karta adds to every message it accepts
(RFC 5321 §4.4):
Received: from client.example.org ([192.0.2.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384)
by mx.example.com with ESMTPS id 0193...
for <user@example.com>; Sat, 07 Nov 2026 12:00:00 +0000Every value that came from the client is checked before it is written, and left out when it does not pass, so a client can never add a line break, a header field or misleading text to it:
- the HELO/EHLO name only when it is an ASCII domain name or address
literal (
Karta.SMTP.Path.valid_domain?/1); otherwise the clause names the client's address (from [192.0.2.1] ([192.0.2.1])); - the recipient (
for, only when there is exactly one, so other recipients are never disclosed) only when it is printable and has no white space; non-ASCII only in an SMTPUTF8 transaction; - the TLS version and cipher only in their known shapes.
The protocol is SMTP, ESMTP or UTF8SMTP, with S for TLS and A
for an authenticated client (RFC 3848, RFC 6531 §3.7.3). A message sent
through a sending API (via: :http) is received with HTTP, from the
client's address, as Postal writes it.
Summary
Functions
Builds the field, folded, ending in CRLF. Raises ArgumentError for an invalid own host name or id.
Types
@type info() :: %{ :hostname => String.t(), :peer_ip => :inet.ip_address(), :id => String.t(), :date => DateTime.t(), optional(:helo) => {:helo | :ehlo, binary()} | nil, optional(:tls) => %{version: String.t(), cipher: String.t()} | nil, optional(:authenticated) => boolean(), optional(:smtputf8) => boolean(), optional(:recipients) => [binary()], optional(:via) => :smtp | :http }
Functions
Builds the field, folded, ending in CRLF. Raises ArgumentError for an invalid own host name or id.