The email channel: a raw email as a Letterbox.Message (parse/2), and
an email made from fields (build/1), for tests and the development
page.
Summary
Functions
An email made from fields, as a mail client would write it: for tests, the development page, and an app's own ingress.
Reads a raw email (RFC 5322, as a mail server took it).
Functions
An email made from fields, as a mail client would write it: for tests, the development page, and an app's own ingress.
Letterbox.Email.build(
from: "José Martínez <jose@example.com>",
to: "photos+abc123@in.example.com",
subject: "Férias",
text: "Here they are.",
attachments: [%{name: "praia.jpg", content_type: "image/jpeg", data: jpeg}]
)Fields: :from, :to, :cc, :reply_to (an address or a list of
them, as strings or Letterbox.Address), :subject, :text, :html,
:attachments (maps or keywords of :name, :content_type, :data,
and :content_id for one the HTML shows), :message_id,
:in_reply_to, :references, :date (a DateTime, now by default),
and :headers, a list of {name, value} more.
@spec parse(binary(), keyword()) :: Letterbox.Message.t()
Reads a raw email (RFC 5322, as a mail server took it).
Options:
:recipients- the addresses the mail server took it for (its envelope'sRCPT TO), when the ingress knows them. They are the message's:recipients; without them, itsTo,Cc,Delivered-ToandX-Original-Toare.:trusted_servers- theauthserv-ids of the mail servers the app trusts to check senders (its provider's, its own), whoseAuthentication-Resultsgive the message's:verified_from. Only a server that removes the headers others wrote in its name should be trusted (RFC 8601, section 5). None by default: no sender is verified.:max_depthand:max_parts, asLetterbox.MIME.parse/2's.