English | 简体中文 | Français | 日本語 | 한국어 | Español
Official Python examples for CleanTempMail - a free temporary email service with powerful API.
- Generate temporary emails instantly
- Receive emails in real-time
- Access 500 recent emails per address
- Statistics API for analytics
- Zero cost - completely free with generous rate limits
No external dependencies required! All examples use only Python standard library.
git clone https://github.com/cleantempmail/cleantempmail-python-examples.git
cd cleantempmail-python-examplesFor async examples (optional):
pip install -r requirements.txtGet your free API key at CleanTempMail API
For testing, use: ct-test
| File | Description |
|---|---|
demo.py |
Complete demonstration of all API features - Run this first! |
| File | Description |
|---|---|
01_generate_email.py |
Generate a random temporary email |
02_custom_email.py |
Create email with custom prefix |
03_receive_email.py |
Receive and read incoming emails |
04_auto_polling.py |
Auto-poll for new emails |
05_delete_email.py |
Delete specific email |
06_clear_inbox.py |
Clear entire inbox |
| File | Description |
|---|---|
07_statistics.py |
Get system statistics |
08_async_client.py |
Async/await API client |
09_verification_code.py |
Extract verification codes |
10_multiple_addresses.py |
Manage multiple emails |
| File | Description |
|---|---|
cleantempmail.py |
Reusable Python client class |
example_client.py |
How to use the client class |
import requests
# Configuration
API_KEY = "ct-test"
BASE_URL = "https://cleantempmail.com/api"
# Generate email
response = requests.get(
f"{BASE_URL}/generate-email",
headers={"X-API-Key": API_KEY}
)
email = response.json()["data"]["email"]
print(f"✅ Generated: {email}")
# Wait for emails
import time
time.sleep(10)
# Get emails
response = requests.get(
f"{BASE_URL}/emails",
params={"email": email},
headers={"X-API-Key": API_KEY}
)
emails = response.json()["data"]["emails"]
print(f"📧 Received {len(emails)} emails")| Endpoint | Method | Description |
|---|---|---|
/api/generate-email |
GET/POST | Generate temporary email |
/api/emails |
GET | Get emails for address |
/api/email/{id} |
GET | Get single email |
/api/email/{id} |
DELETE | Delete email |
/api/emails/clear |
DELETE | Clear all emails |
/api/stats |
GET | System statistics |
/api/statistics/24h |
GET | 24h distribution |
/api/statistics/top-subjects |
GET | Popular subjects |
/api/statistics/top-domains |
GET | Popular domains |
/api/statistics/top-senders |
GET | Popular senders |
- Testing - Test email verification flows
- Automation - Automate sign-up processes
- Privacy - Protect your real email
- Development - Test email features without SMTP
- QA - Verify email delivery
MIT License - feel free to use in your projects!
- 🌍 Website: cleantempmail.com
- 📚 API Docs: cleantempmail.com/api
- 💬 Issues: GitHub Issues
If you find this useful, please star the repository!
Made with ❤️ by CleanTempMail