Skip to main content

Creating a client

See Authentication for details on all three options.

Building a message

Use Message::builder() to compose a message. All methods take impl Into<String> or iterables:
.build() returns Err(PauboxError::Validation(...)) if from, to, or subject is missing. It doesn’t check that a text or HTML body is set.

Attachments

The from_bytes constructor base64-encodes the data automatically; no manual encoding needed:
If you already have base64-encoded content:
Add attachments to a message via the builder:

Send a message

SendResponse fields:

Check delivery status

MessageDelivery fields: In paubox 1.3.1 through 2.0.0, get_email_disposition returns PauboxError::Deserialize for a delivered message that hasn’t been opened yet, because the API sends openedStatus as null until the first open. The call succeeds once the message is opened, and for statuses that carry no open data, such as processing or a bounce.

Scheduled send

Schedule a message for future delivery, check its status, reschedule, or cancel it.

Schedule a message

scheduled_at must be an ISO 8601 UTC datetime string in the future and within 30 days. The examples compute it with the chrono crate; add chrono = "0.4" to your dependencies, or pass any timestamp string you already have.

Get scheduled message status

ScheduledMessageStatus fields:

Reschedule a message

Cancel a scheduled message

Health check

In paubox 1.3.1 through 2.0.0, client.api_status() sends GET to the base URL (https://api.paubox.com/v1/email/), which isn’t an API route, so it returns a PauboxError even when the API is reachable. Don’t use it as a health check.

Error handling

All methods return Result<T, PauboxError>. Match on the variants to handle specific conditions:
PauboxError variants: