Rust SDK
The jetemail crate is the official Rust SDK for JetEmail transactional email (MIT license, async via reqwest on Tokio, with an optionalblocking feature for synchronous use).
Create a transactional API key in the dashboard: Outbound → Keys → Add API key. Use that key with the SDK.
Installation
Cargo.toml:
native-tls by default; enable the rustls feature instead with jetemail = { version = "0.1", default-features = false, features = ["rustls"] }.
Crate on crates.io: jetemail. Source on GitHub: jetemail/jetemail-rust.
Quick start
from address on a verified domain (see Getting started).
Creating a client
JetEmail is Clone and exposes two services as public fields:
client.emails.send(email)
Send a single email. Build the request with CreateEmailOptions::new(from, to, subject) and chain with_* methods for optional fields. All fields are also public on the struct.
Responses
send returns jetemail::Result<CreateEmailResponse>, where CreateEmailResponse { id: String }.
client.batch.send(emails)
Send up to 100 emails in one request as a Vec<CreateEmailOptions>. The SDK rejects an empty vec or more than 100 emails client-side (returned as Error::JetEmail with status_code: 0). Returns BatchEmailResponse { data: Vec<CreateEmailResponse> }.
Attachments
Attachment::from_content(bytes, filename) base64-encodes in-memory bytes; Attachment::from_path(path) reads a file synchronously (returning std::io::Result<Attachment>) and uses the file name as the filename. Attachments are sent as { "filename": ..., "data": <base64> }.
jetemail::Error does not implement From<std::io::Error>, so using ? on from_path requires a function that returns Result<_, Box<dyn std::error::Error>> (or map the error yourself).Error handling
All methods returnjetemail::Result<T> (an alias for Result<T, jetemail::Error>). The Error enum has three variants:
Blocking usage
Enable theblocking feature to use the same API synchronously (no Tokio required). JetEmail::with_client and ConfigBuilder::client then take a reqwest::blocking::Client.
For additional examples, see the README on GitHub. REST details: API reference.