The header section of a message (RFC 5322 §2.2), as a list of fields that keeps every byte of the original, so unchanged fields are passed through exactly (folding and all), which matters for signatures.
{:ok, header, body} = Headers.split(data)
fields = Headers.parse(header)
fields |> Headers.delete(["Return-Path"]) |> Headers.encode()Each field is {name, raw}: the lower-cased field name and the whole
field with its continuation lines and final CRLF. A line in the header
section that is not a field is kept with name nil.
Summary
Functions
Appends a field. value must already be folded if long.
Removes every field with one of names (case-insensitive).
Encodes fields back into a header section.
Returns whether a field named name is present (case-insensitive).
Parses a header section (CRLF line endings) into fields.
Splits message data at the empty line that ends the header section.
Returns :more when data does not contain it yet. A message that
starts with an empty line has no header fields.
Types
Functions
Appends a field. value must already be folded if long.
Removes every field with one of names (case-insensitive).
Encodes fields back into a header section.
Returns whether a field named name is present (case-insensitive).
Parses a header section (CRLF line endings) into fields.
Splits message data at the empty line that ends the header section.
Returns :more when data does not contain it yet. A message that
starts with an empty line has no header fields.