Skip to main content

Crate anypost

Crate anypost 

Source
Expand description

Official Rust SDK for the Anypost email API.

Build a Client, then send mail and manage domains, API keys, templates, webhooks, suppressions, and the event stream. The client is async (built on reqwest); a synchronous blocking::Client is available under the blocking feature.

use anypost::{Client, SendEmail};

let client = Client::new("ap_your_api_key")?;

let email = client
    .email
    .send(
        &SendEmail::new("Acme <you@yourdomain.com>", ["someone@example.com"])
            .subject("Hello from Anypost")
            .html("<p>It worked.</p>"),
    )
    .await?;

println!("queued {}", email["id"]);

Keep the API key server-side. It is a bearer credential.

Re-exports§

pub use types::email::Attachment;
pub use types::email::BatchEmail;
pub use types::email::ReplyTo;
pub use types::email::SendEmail;
pub use types::email::Tracking;
pub use types::email::Unsubscribe;
pub use types::email::UnsubscribeMode;
pub use types::params::EventListParams;
pub use types::params::ListParams;
pub use types::params::SuppressionListParams;
pub use webhook::unwrap;
pub use webhook::unwrap_with_options;
pub use webhook::verify;
pub use webhook::verify_with_options;
pub use webhook::VerifyOptions;
pub use webhook::WebhookErrorReason;
pub use webhook::WebhookVerificationError;

Modules§

blocking
A synchronous client, available under the blocking feature.
transport
The HTTP and timing seams the client is built on.
types
Request input types: typed builders for the send path and parameter structs for list endpoints.
webhook
Verify the signature on an Anypost webhook delivery.

Structs§

ApiError
The payload carried by every API-level error: the canonical envelope plus the HTTP status and request id.
ApiKeys
Operations on the /api-keys endpoints.
Client
Async client for the Anypost email API.
ClientBuilder
Builder for Client.
Domains
Operations on the /domains endpoints.
Email
Operations on the /email endpoints.
Events
Read access to the /events stream. List-only — events are not addressable by id.
Identity
Identity operations (/whoami).
Page
One page of a list result.
Response
An immutable view over a decoded JSON response object.
Suppressions
Operations on the /suppressions endpoints. Entries key on (email, topic).
Templates
Operations on the /templates endpoints, including the draft/publish flow.
Webhooks
Operations on the /webhooks endpoints.

Enums§

Error
Every error this crate can return.

Constants§

VERSION
The crate version, single-sourced from Cargo.toml. Bump the version there, tag the commit vX.Y.Z, and push — the release workflow publishes to crates.io.

Type Aliases§

Result
A convenience alias for results returned by this crate.