sendr_smtp

Package VersionHex Docs

An SMTP backend for sendr. It delivers email messages over SMTP, optionally with TLS and authentication.

It tries to adhere to the SMTPUTF8, 8BITMIME, STARTTLS, AUTH and SIZE extensions and of course to all relevant RFC's.

WARNING Dispite extensive testing no guarantee is given the spec is followed flawless and interaction with every SMTP-server will work.

50+ years of extensions on top of the original SMTP en Internet Message specification make it hard to navigate this labyrinth of RFC's. I've done my best to implement this library according to the relevant RFC's (as listed below) and keeping the code sane and testable. However I might have failed at this. Any bug reports are appreciated, but no promises are made I will, or even will be able to fix them.

gleam add sendr sendr_smtp

Usage

import sendr/message
import sendr/message/mailbox
import sendr/message/body
import sendr_smtp
pub fn send_email() {
let config =
sendr_smtp.config("smtp.example.com", 587)
|> sendr_smtp.credentials("user", "pass")
let msg =
message.new()
|> message.set_from(mailbox.new("Señora Alice", "alice@example.com"))
|> message.set_to([mailbox.new("Bob", "bob@example.com"]))
|> message.set_subject("Hola, señora")
|> message.set_body(body.empty |> body.set_text("¡Hola desde Gleam!"))
sendr_smtp.deliver(msg, with: config)
}

Implemented RFCs

RFCDescription
RFC 822ARPA Internet Text Messages (structured/unstructured header field types)
RFC 2045MIME Part One: base64, bit encoding, quoted-printable, and text encoding
RFC 2047MIME Part Three: Message Header Extensions for Non-ASCII Text
RFC 3986Uniform Resource Identifier: percent-encoding
RFC 5321Simple Mail Transfer Protocol
RFC 5322Internet Message Format
RFC 5890Internationalized Domain Names for Applications (IDNA)
RFC 6854Updates to RFC 5322

Development

gleam test # Run the tests
gleam run -m devutils/glinter -- --stats # Run the code style checks