Every dashboard action is an MCP tool your agent can call.Read the docs
Rust email API

Send product email from Rust. Keep types, timeouts, and retries explicit.

Send transactional email and publish lifecycle events from typed async Rust services with the Send & Retain API.

Use reqwest and serde with the async runtime your service already owns.

Server quickstart
Rust

One request, complete trace

Request

POST /api/v1/emails

Authorization: Bearer aem_…

Idempotency-Key: welcome-8f21

{ "to": "[email protected]", "template": "welcome" }

202 Accepted

{ "id": "msg_7ca31", "status": "queued" }

RuntimeServer process
RequestPOST /api/v1/emails
Result202 · queued
Credentials stay server-side

[ 01 / 04 ]Client contract

Keep the wire contract typed without hiding the network.

Use reqwest and serde

Model the request and response with your own types and reuse one async HTTP client.

Send typed payloads

serde structs give you a payload the compiler validates before it ever leaves the process.

Handle delivery events

Take the body as Bytes before deserialising, so the HMAC is computed over the wire format.

[ 02 / 04 ]Server quickstart

Queue one email from Rust.

Server-side only, idempotent by key, and it returns an ID you can trace.

Use the async client already owned by the service instead of constructing one per request.

send_welcome.rs
let response = client.post(EMAIL_URL)
    .bearer_auth(api_key)
    .header("Idempotency-Key", format!("welcome-{}", user.id))
    .json(&json!({ "to": user.email, "template": "welcome" }))
    .send().await?
    .error_for_status()?;

Accepted response

{ "id": "msg_7ca31", "status": "queued" }

[ 03 / 04 ]Quickstart

Make every network outcome part of the type-aware path.

01

Reuse an async client

Configure the timeout once and load the credential from process or secret-manager configuration.

02

Classify the result

Keep transport failures, structured API errors, and accepted sends distinct in your error type.

03

Persist the accepted ID

Carry the identifier into logs or domain state so the delivery event can be correlated later.

Production checklist

  • Secrets stay server-side
  • Timeout and retry policy
  • Idempotent webhook handler
  • Structured error logging

Questions people ask us

Queue your first Rust email.

Reuse your async client and carry one message ID from acceptance to delivery.