Skip to main content

Crate guerrillamail_client

Crate guerrillamail_client 

Source
Expand description

§GuerrillaMail Client

Asynchronous wrapper around the GuerrillaMail disposable email HTTP API, providing simple methods to create, poll, and delete temporary inboxes from Rust using Client and ClientBuilder.

§Audience and uses

For Rust developers who need throwaway addresses in integration tests, demos, or automation scripts without running mail infrastructure: configure with ClientBuilder, obtain an address, poll for messages (Message), then discard the inbox when done.

§Runtime requirements

Async-only; run inside a Tokio (v1) runtime. HTTP calls use reqwest, so ensure the chosen Tokio features (rt-multi-thread or current_thread) are available in your application.

§Out of scope

Not a general-purpose mail client, SMTP sender, or durable mailbox. It only proxies the GuerrillaMail service and inherits its availability, spam filtering, and retention limits.

§Errors

All network calls surface transport and non-2xx statuses as Error::Request; shape or content issues become Error::ResponseParse or Error::Json. The crate-wide Result alias wraps these errors.

§Example

use guerrillamail_client::Client;

#[tokio::main]
async fn main() -> Result<(), guerrillamail_client::Error> {
    let client = Client::new().await?;
    let email = client.create_email("myalias").await?;
    println!("Created: {}", email);

    let messages = client.get_messages(&email).await?;
    for msg in messages {
        println!("From: {}, Subject: {}", msg.mail_from, msg.mail_subject);
    }

    client.delete_email(&email).await?;
    Ok(())
}

Structs§

Attachment
Attachment metadata returned by GuerrillaMail.
Client
High-level async handle to a single GuerrillaMail session.
ClientBuilder
Configures and bootstraps a GuerrillaMail Client.
EmailDetails
Full email details including body content.
Message
An email message header returned by GuerrillaMail.

Enums§

Error
Errors that can occur during GuerrillaMail operations.

Type Aliases§

Result
Result type alias for GuerrillaMail operations.