howdy/mail/resend

Send mail with Resend’s HTTP API.

let assert Ok(config) = resend.from_env()
let mailer = mail.mailer(resend.adapter(config))

The sender’s domain must be verified with Resend. Each message’s id is sent as the Idempotency-Key, so retrying the same Outgoing after a timeout does not send it twice. Resend allows only letters, digits, _ and - in tags, so other characters in mail.tag become _, and each tag is sent as a name with the value true.

Types

pub opaque type Config

Values

pub fn adapter(config: Config) -> mail.Adapter
pub fn base_url(config: Config, url: String) -> Config

Where the API is, without a trailing slash. Default https://api.resend.com.

pub fn from_env() -> Result(Config, Nil)

Read the API key from RESEND_API_KEY.

pub fn new(api_key: String) -> Config
pub fn receipt(
  outgoing: mail.Outgoing,
  response: response.Response(String),
) -> Result(mail.Receipt, mail.Error)

The receipt for Resend’s response to request.

pub fn request(
  config: Config,
  outgoing: mail.Outgoing,
) -> Result(request.Request(String), mail.Error)

The request adapter sends.

pub fn tag_name(tag: String) -> String

Letters, digits, _ and -, at most 256 characters.

pub fn timeout(config: Config, milliseconds: Int) -> Config

How long to wait for Resend. Default 15 seconds.

✨ Search Document