Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lpil/zeptomail
A client for the Zeptomail transactional email API
https://github.com/lpil/zeptomail
api-client email gleam-lang
Last synced: about 1 month ago
JSON representation
A client for the Zeptomail transactional email API
- Host: GitHub
- URL: https://github.com/lpil/zeptomail
- Owner: lpil
- Created: 2022-06-23T22:33:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-06T13:35:56.000Z (about 1 year ago)
- Last Synced: 2024-09-17T10:45:51.797Z (about 2 months ago)
- Topics: api-client, email, gleam-lang
- Language: Gleam
- Homepage: https://www.zoho.com/zeptomail/
- Size: 12.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-gleam - zeptomail - [📚](https://hexdocs.pm/zeptomail/) - A wrapper for ZeptoMail's transactional email API (Packages / Email)
README
# zeptomail
[![Package Version](https://img.shields.io/hexpm/v/zeptomail)](https://hex.pm/packages/zeptomail)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/zeptomail/)A wrapper for [ZeptoMail's transactional email API](https://www.zoho.com/zeptomail/).
## Usage
Add this package to your Gleam project:
```sh
gleam add zeptomail
```And then send some email!
```gleam
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)
}
```