Skip to main content

Crate emailit

Crate emailit 

Source
Expand description

§emailit

Official Rust SDK for the Emailit API v2.

Provides an async-first client for sending transactional emails, managing domains, API keys, audiences, subscribers, templates, suppressions, contacts, webhooks, email verifications, and events.

§Quick start

use emailit::types::CreateEmailBaseOptions;
use emailit::{Emailit, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let emailit = Emailit::new("secret_xxxxxxxxx");

    let from = "Acme <onboarding@emailit.dev>";
    let to = ["delivered@emailit.dev"];
    let subject = "Hello World";

    let email = CreateEmailBaseOptions::new(from, to, subject)
        .with_html("<strong>It works!</strong>");

    let _email = emailit.emails.send(email).await?;

    Ok(())
}

Re-exports§

pub use client::RawResponse;
pub use collection::Collection;
pub use error::ApiError;
pub use error::Error;
pub use webhook_signature::HEADER_SIGNATURE;
pub use webhook_signature::HEADER_TIMESTAMP;
pub use webhook_signature::compute_webhook_signature;
pub use webhook_signature::verify_webhook_signature;
pub use types::*;

Modules§

client
Low-level HTTP client used internally by all service modules.
collection
Generic paginated collection returned by list endpoints.
error
Error types for the Emailit SDK.
services
Service modules for each Emailit API v2 resource.
types
Request and response types for all Emailit API v2 resources.
webhook_signature
Webhook signature verification for incoming Emailit webhook events.

Structs§

Emailit
The main Emailit API client.

Constants§

VERSION
The SDK version, read from Cargo.toml at compile time.

Type Aliases§

Result
Convenience type alias for std::result::Result<T, emailit::Error>.