yopmail-client is a small async Rust crate for working with temporary YOPmail inboxes from tests, demos, and automation. It can list inbox pages, fetch message content, download attachments, and send YOPmail-to-YOPmail messages.
[!NOTE] This crate is unofficial. It talks to YOPmail's public web endpoints, so changes to YOPmail's HTML or request flow can require parser updates.
Features
- List inbox messages with paging.
- Fetch plain text, extracted HTML, raw HTML, and attachment links.
- Download message attachments as bytes.
- Send messages from a YOPmail mailbox to
@yopmail.comrecipients. - Generate random mailbox names for disposable test flows.
- Configure timeout, proxy, and base URL through
YopmailClientBuilder. - Work with simple
serde-serializable models.
Install
The client is async. The examples below use Tokio:
Quickstart
use ;
async
Most methods open the session lazily. Call open_inbox() yourself when you want that state transition to be explicit:
let mut client = new?;
client.open_inbox.await?;
let messages = client.list_messages.await?;
Customize the underlying HTTP client with the builder:
use Duration;
use YopmailClient;
let mut client = builder
.timeout
.proxy_url
.build?;
Examples
This repository ships two examples:
API Overview
| Task | Method |
|---|---|
| Create a client | YopmailClient::new, YopmailClient::builder |
| Initialize session | open_inbox |
| List inbox | list_messages |
| Fetch content | fetch_message, fetch_message_full |
| Download files | download_attachment |
| Send mail | send_message |
| Helpers | generate_random_mailbox |
Mailboxes are local parts only. The domain is always yopmail.com.
Notes
[!TIP] Prefer
generate_random_mailbox()for tests and demos so multiple runs do not collide in a shared public inbox.
YopmailClientis stateful and methods take&mut selfbecause cookies and theyptoken are refreshed on demand.send_messagecurrently accepts only recipients ending in@yopmail.com.fetch_message_fullretries a few YOPmail message ID variants after HTTP 400 responses, but the crate does not implement network retry or polling loops.- Non-success responses from core inbox, mail, send, and attachment requests are returned as
Error::Statuswith the response body captured for debugging.
Resources
- API documentation on docs.rs
- Package on crates.io
- YOPmail
- Python yopmail-client, which inspired this Rust port