Sovite.Message.Trace (sovite v0.2.0)

Copy Markdown View Source

Trace header fields and the loop checks that read them.

  • Return-Path: - added at final delivery with the envelope sender (RFC 5321 §4.4).
  • Delivered-To: - added at final delivery with the recipient (RFC 9228). A message that already carries one for the same recipient has been here before: a mail loop.
  • Received: - one per hop. Too many of them is a loop too (RFC 5321 §6.3).

Header fields are as returned by Sovite.Message.Headers.parse/1.

Summary

Functions

The Delivered-To: field for recipient.

Whether a Delivered-To: field names recipient, compared without regard to case.

The number of Received: fields.

The Return-Path: field for sender ("" for the null reverse-path).

Functions

delivered_to(recipient)

@spec delivered_to(String.t()) :: String.t()

The Delivered-To: field for recipient.

iex> Sovite.Message.Trace.delivered_to("bob@example.com")
"Delivered-To: bob@example.com\r\n"

delivered_to?(fields, recipient)

@spec delivered_to?([Sovite.Message.Headers.field()], String.t()) :: boolean()

Whether a Delivered-To: field names recipient, compared without regard to case.

hops(fields)

The number of Received: fields.

return_path(sender)

@spec return_path(String.t()) :: String.t()

The Return-Path: field for sender ("" for the null reverse-path).

iex> Sovite.Message.Trace.return_path("alice@example.com")
"Return-Path: <alice@example.com>\r\n"