Skip to content

A client for the Zeptomail transactional email API

Notifications You must be signed in to change notification settings

kadei-rat/gleam-zeptomail

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zeptomail

Package Version Hex Docs

A wrapper for ZeptoMail's transactional email API.

Usage

Add this package to your Gleam project:

gleam add zeptomail

And then send some email!

import gleam/httpc
import zeptomail.{Addressee}

pub fn main() {
  let key = "your-api-key-here"

  // Create an email to send
  let email = zeptomail.Email(
    from: Addressee("Mike", "[email protected]"),
    to: [Addressee("Joe", "[email protected]")],
    reply_to: [],
    cc: [Addressee("Robert", "[email protected]")],
    bcc: [],
    body: zeptomail.TextBody("Hello, Mike!"),
    subject: "Hello, Joe!",
  )

  // Prepare an API request that sends the email
  let request = zeptomail.email_request(email, key)

  // Send the API request using `gleam_httpc`
  let assert Ok(response) = httpc.send(request)

  // Parse the API response to verify success
  let assert Ok(data) = zeptomail.decode_email_response(response)
}

About

A client for the Zeptomail transactional email API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Gleam 100.0%