> ## 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.

# Rust SDK quickstart

> Install the Paubox Rust SDK and send your first HIPAA compliant email in minutes.

**1. Add the dependency**

Add `paubox` and `tokio` to your `Cargo.toml`:

```toml theme={null}
[dependencies]
paubox = "2.0"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
```

**2. Set your credentials**

Export your API key as an environment variable:

```bash theme={null}
export PAUBOX_API_KEY="YOUR_API_KEY"
```

To obtain your API key, see [Authentication](https://docs.paubox.com/rust-sdk/authentication.md).

**3. Send your first email**

Create `src/main.rs`:

```rust theme={null}
use paubox::{email::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:

```bash theme={null}
cargo run
```

```
Sent. Tracking ID: abc123-def456-...
```

**4. Check delivery status**

```rust theme={null}
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
```

In paubox 1.3.1 through 2.0.0, this call returns a `Deserialize` error for a delivered message that hasn't been opened yet. See [Check delivery status](https://docs.paubox.com/rust-sdk/email-client.md#check-delivery-status).

## Next steps

* [Email client](https://docs.paubox.com/rust-sdk/email-client.md): attachments, CC/BCC, error handling
* [Forms client](https://docs.paubox.com/rust-sdk/forms-client.md): submit form responses


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.