sendr_sweego

A sendr backend for sending emails via the Sweego.io REST API.

Installation

gleam add sendr sendr_sweego

Usage

import gleam/http
import sendr
import sendr/message
import sendr

pub fn send() {
  let cfg = sendr_sweego.config("sk-abc123")

  let msg =
    message.new()
    |> message.set_from(mailbox.new("Alice", "alice@example.com"))
    |> message.set_to([mailbox.new("Bob", "bob@example.com")])
    |> message.set_subject("Hello from sendr_sweego")
    |> message.set_body(body.new() |> body.set_text("Hello world!"))

  let assert Ok(req) = sendr_sweego.request(msg, cfg)

  // Make the HTTP request with your HTTP client of choice:
  // let resp = http_client.send(req)
  // let result = sendr_sweego.response(resp)
}

Shortcomings / Restrictions

Development

gleam test                                   # Run the tests
SWEEGO_TOKEN=your_token_here gleam test      # Run integration tests and unit tests
gleam run -m devutils/glinter -- --stats     # Run the code style checks
Search Document