Marathon.Email
The email value + a Swoosh-style pure builder pipeline (specs/email.md §3). Provider-agnostic; part of the mail core intended for extraction into a library.
Email.new()
|> Email.from({name: "forgepm.org", address: "[email protected]"})
|> Email.to({name: "", address: "[email protected]"})
|> Email.subject("Confirm your account")
|> Email.text_body("...")Types
Functions
fnbccbcc(email : Email, addr : { name: String, address: String }) : Email do { email with bcc: List.append(email.bcc, [clean_addr(addr)]) } end#
Append a Bcc recipient.
fncccc(email : Email, addr : { name: String, address: String }) : Email do { email with cc: List.append(email.cc, [clean_addr(addr)]) } end#
Append a Cc recipient.
fnfromfrom(email : Email, addr : { name: String, address: String }) : Email do { email with from: clean_addr(addr) } end#
Set the sender.
Add a raw header (name, value). CR/LF are stripped from both.
Set the HTML body.
An empty email: blank from, empty recipient lists and bodies, no reply_to. Fill via the builders.
fnreply_toreply_to(email : Email, addr : { name: String, address: String }) : Email do { email with reply_to: Some(clean_addr(addr)) } end#
Set the Reply-To address.
fnsubjectsubject(email : Email, s : String) : Email do { email with subject: Marathon.Address.strip_crlf(s) } end#
Set the subject. CR/LF are stripped (header-injection guard, specs/email.md §7).
Set the plain-text body.