A Python client for Tacomail
Project description
Tacomail Python Client
An unofficial Python client library for Tacomail, a disposable email service. This library provides both synchronous and asynchronous interfaces to interact with the Tacomail API.
Features
- ๐ Both synchronous and asynchronous clients
- ๐ง Generate random email addresses
- ๐ฅ Fetch and manage temporary inboxes
- ๐ Handle email attachments
- โฑ๏ธ Wait for specific emails with filtering capabilities
- ๐ Full type hints and dataclass models
Installation
Standard Installation
pip install tacomail
Using uvx (Recommended)
# Install and run CLI without affecting system Python
uvx tacomail create
CLI Commands
The tacomail CLI provides comprehensive command-line interface for Tacomail disposable email service. All commands support both sync and async modes via the --async flag.
Available Commands
Email Generation & Domains:
tacomail create- Generate random email addresstacomail create-with-session- Generate email and create session in one command (RECOMMENDED)tacomail new- Short alias for 'create-with-session' (RECOMMENDED)tacomail list-domains- List all available Tacomail domains
Session Management:
tacomail create-session <email>- Create API session for receiving emailstacomail delete-session <email>- Delete API session
Inbox Operations:
tacomail list <email>- List recent emails in inboxtacomail get <email> <id>- Get specific email detailstacomail delete <email> <id>- Delete specific emailtacomail clear <email>- Delete all emails from inbox
Email Waiting:
tacomail wait <email>- Wait for new email to arrive--timeout <seconds>- Maximum wait time (default: 30)--interval <seconds>- Check interval (default: 2)--filter <pattern>- Filter by subject/sender (regex)
Global Options
--output,-o- Output format:rich(default),plain, orjson--async- Use async client instead of sync--verbose- Enable verbose/debug output--help- Show help message
Output Formats
The CLI supports three output formats via the --output option:
Rich (default): Beautiful formatted output with colors and panels
tacomail create
# โญโโโโโโโโโโโโโโ โจ Success โโโโโโโโโโโโโโโฎ
# โ Generated Email: โ
# โ x7k9m2@tacomail.de โ
# โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Plain: Simple key=value format for shell scripting
tacomail --output plain create
# email=x7k9m2@tacomail.de
tacomail -o plain list user@tacomail.de
# id123 sender@example.com Subject Line 2026-01-15 10:30
JSON: Machine-readable JSON output
tacomail --output json create
# {"email": "x7k9m2@tacomail.de"}
tacomail -o json list user@tacomail.de
# [{"id": "id123", "from": "sender@example.com", "subject": "Subject Line", "date": "2026-01-15 10:30"}]
Help for Specific Commands
Each command has its own help:
tacomail create --help
tacomail wait --help
tacomail list --help
# etc.
Quick Start for Receiving Emails
Recommended Workflow (Single Command)
Quick Start: Create email and session in one step
tacomail create-with-session
# Or use the short alias:
tacomail new
# Output: Email address and session information with expiration time
# Example:
# โญโโโโโโโโโโโโโโโโโโโโโโโโโโ โจ Email & Session Ready โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
# โ Email Address: โ
# โ x7k9m2@tacomail.de โ
# โ โ
# โ Session Created โ
# โ โ
# โ Expires: 2026-01-15 23:59:59 โ
# โ Username: x7k9m2 โ
# โ Domain: tacomail.de โ
# โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
With options:
# Use specific domain
tacomail create-with-session --domain tacomail.de
# Or with the alias:
tacomail new --domain tacomail.de
# Use specific username and domain
tacomail create-with-session --username myuser --domain tacomail.de
# Or with the alias:
tacomail new -u myuser -d tacomail.de
# Short options
tacomail create-with-session -d tacomail.de -u myuser
# Or with the alias:
tacomail new -d tacomail.de -u myuser
Using with async mode:
tacomail --async create-with-session
# Or with the alias:
tacomail --async new
Wait for emails:
# After creating with session, wait for incoming email
EMAIL="x7k9m2@tacomail.de" # Replace with your generated email
tacomail wait $EMAIL
# Monitors inbox and waits for incoming email
# Displays: From, Subject, Body when email arrives
Alternative: Two-Step Workflow
Step 1: Generate email address
tacomail create
# Output: x7k9m2@tacomail.de
Step 2: Create session (REQUIRED for receiving emails)
tacomail create-session x7k9m2@tacomail.de
# Output: Session created, expires at [timestamp]
Step 3: Wait for emails
tacomail wait x7k9m2@tacomail.de
# Monitors inbox and waits for incoming email
# Displays: From, Subject, Body when email arrives
Complete Workflow Example
# Generate email and create session (using plain output for easy parsing)
EMAIL=$(tacomail -o plain new | grep '^email=' | cut -d'=' -f2)
# Monitor inbox for incoming emails
tacomail wait $EMAIL --timeout 60
Commands Needed for Receiving Emails
To receive emails, you can use either approach:
Quick Method (Recommended)
- โ
tacomail create-with-session- Generate email AND create session in one command (or usetacomail new- short alias) - โ
tacomail wait <email>- Monitor inbox for incoming emails
Step-by-Step Method
- โ
tacomail create- Generate email address - โ
tacomail create-session <email>- Create session (REQUIRED) - โ
tacomail wait <email>- Monitor inbox for incoming emails
Common Workflows
Workflow 1: Quick setup for testing
# Create and start receiving emails immediately
tacomail new # or: tacomail create-with-session
tacomail wait <generated-email>
Workflow 2: Automated script
#!/bin/bash
# Get email and session using plain output (easy to parse)
EMAIL=$(tacomail -o plain new | grep '^email=' | cut -d'=' -f2)
echo "Created: $EMAIL"
# Or using JSON output with jq
EMAIL=$(tacomail -o json new | jq -r '.email')
echo "Created: $EMAIL"
# Monitor for emails (timeout 60s)
tacomail wait $EMAIL --timeout 60
Workflow 3: Specific domain for testing
# Use a specific domain if your service requires it
tacomail new --domain tacomail.de # or: tacomail create-with-session --domain tacomail.de
tacomail list <generated-email>
Optional: Check Inbox
You can check your inbox before waiting:
tacomail list x7k9m2@tacomail.de
# Shows all emails already in inbox
Quick Start
Synchronous Usage
from tacomail import TacomailClient
with TacomailClient() as client:
# Get a random email address
username = client.get_random_username()
domains = client.get_domains()
email_address = f"{username}@{domains[0]}"
# Create a session to receive emails (required for API v2)
session = client.create_session(username, domains[0])
print(f"Session expires at: {session.expires}")
# Wait for an email to arrive
email = client.wait_for_email(email_address, timeout=30)
if email:
print(f"From: {email.from_.address}")
print(f"Subject: {email.subject}")
print(f"Body: {email.body.text}")
Asynchronous Usage
import asyncio
from tacomail import AsyncTacomailClient
async def main():
async with AsyncTacomailClient() as client:
# Get a random email address
username = await client.get_random_username()
domains = await client.get_domains()
email_address = f"{username}@{domains[0]}"
# Create a session to receive emails (required for API v2)
session = await client.create_session(username, domains[0])
# Wait for an email with specific subject
def filter_email(email):
return email.subject == "Welcome!"
email = await client.wait_for_email_filtered(
email_address,
filter_fn=filter_email,
timeout=30
)
if email:
print(f"Found email: {email.subject}")
asyncio.run(main())
API Reference
Main Classes
TacomailClient: Synchronous client for Tacomail APIAsyncTacomailClient: Asynchronous client for Tacomail APIEmail: Dataclass representing an email messageEmailAddress: Dataclass for email addressesEmailBody: Dataclass for email contentAttachment: Dataclass for email attachmentsSession: Dataclass for inbox session information
Common Methods
Both sync and async clients provide these methods:
create_session(username, domain): Create an inbox session to receive emailsdelete_session(username, domain): Delete an inbox sessionget_random_username(): Generate a random usernameget_domains(): Get list of available domainsget_random_address(): Get a complete random email addressget_inbox(address, limit=None): Get recent emailsget_email(address, mail_id): Get a specific emailget_attachments(address, mail_id): Get email attachmentsdownload_attachment(address, mail_id, attachment_id): Download an attachmentdelete_email(address, mail_id): Delete a specific emaildelete_inbox(address): Delete all emails in an inboxwait_for_email(address, timeout=30, interval=2): Wait for new emailwait_for_email_filtered(address, filter_fn, timeout=30, interval=2): Wait for email matching criteria
Requirements
- Python โฅ 3.12
- httpx โฅ 0.28.0
Development
# Install development dependencies
pip install -e ".[dev]"
Running Tests
The test suite uses Postmark to send real test emails to the Tacomail addresses. This ensures the library works with actual email delivery.
- Sign up for a Postmark account
- Create a
.envfile in the project root with your credentials:
# .env
POSTMARK_API_KEY=your_postmark_api_key_here
SENDER_EMAIL=your_email_address_here # The verified sender email in Postmark
Then run the tests:
pytest
# Run linter
ruff check .
Credits
- Tacomail Service: https://tacomail.de/
- Tacomail Repository: oskar2517/tacomail
- Tacomail API Documentation: API.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tacomail-0.3.0.tar.gz.
File metadata
- Download URL: tacomail-0.3.0.tar.gz
- Upload date:
- Size: 27.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a502dae0bd5b16fc70c1c5bcabf0e330779d966939fb555cf1dab51f77ffd5d2
|
|
| MD5 |
e8b9aadc866f1e5568f3922e8706aa3a
|
|
| BLAKE2b-256 |
9cca38f6dffa4f0e8579df899ea7a5712dfa9c4f5b0de59759259dd3a168a94c
|
Provenance
The following attestation bundles were made for tacomail-0.3.0.tar.gz:
Publisher:
publish.yml on sokripon/python-tacomail
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tacomail-0.3.0.tar.gz -
Subject digest:
a502dae0bd5b16fc70c1c5bcabf0e330779d966939fb555cf1dab51f77ffd5d2 - Sigstore transparency entry: 835708785
- Sigstore integration time:
-
Permalink:
sokripon/python-tacomail@90a889a47b7c320dfd22e6659651c6e4e0b6478d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sokripon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90a889a47b7c320dfd22e6659651c6e4e0b6478d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file tacomail-0.3.0-py3-none-any.whl.
File metadata
- Download URL: tacomail-0.3.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efb4a627ee3de597bdbabb025fec596634e3a1abaf58b427185e1cbc2955eca1
|
|
| MD5 |
165ea761a0b3658f6af10bab2a31d4c1
|
|
| BLAKE2b-256 |
e121a1efc4871f3e6ab971774cc7da7d4ad1cf0377770aba781fed88d2ccd387
|
Provenance
The following attestation bundles were made for tacomail-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on sokripon/python-tacomail
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tacomail-0.3.0-py3-none-any.whl -
Subject digest:
efb4a627ee3de597bdbabb025fec596634e3a1abaf58b427185e1cbc2955eca1 - Sigstore transparency entry: 835708793
- Sigstore integration time:
-
Permalink:
sokripon/python-tacomail@90a889a47b7c320dfd22e6659651c6e4e0b6478d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sokripon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90a889a47b7c320dfd22e6659651c6e4e0b6478d -
Trigger Event:
workflow_dispatch
-
Statement type: