Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.paubox.com/llms.txt

Use this file to discover all available pages before exploring further.

1

Add the dependency

Add paubox and tokio to your Cargo.toml:
[dependencies]
paubox = "0.1"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
2

Set your credentials

Export your API key and username as environment variables:
export PAUBOX_API_KEY="YOUR_API_KEY"
export PAUBOX_API_USER="YOUR_USERNAME"
To obtain credentials, see Authentication.
3

Send your first email

Create src/main.rs:
use paubox::{Message, PauboxClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = PauboxClient::from_env()?;

    let message = Message::builder()
        .from("sender@yourdomain.com")
        .to(["recipient@example.com"])
        .subject("Your first Paubox email")
        .text_content("This message was sent with the Paubox Rust SDK.")
        .build()?;

    let response = client.send_message(&message).await?;

    println!("Sent. Tracking ID: {}", response.source_tracking_id);

    Ok(())
}
Run it:
cargo run
Sent. Tracking ID: abc123-def456-...
4

Check delivery status

let disposition = client
    .get_email_disposition(&response.source_tracking_id)
    .await?;

for delivery in &disposition.message_deliveries {
    println!("{} → {}", delivery.recipient, delivery.delivery_status);
}
recipient@example.com → delivered

Next steps