Professional temporary email service wrapper with a comprehensive CLI tool.
Project description
TemMail
TemMail is a professional Python wrapper for the temp-mail.io API, providing advanced temporary email functionality with a comprehensive CLI tool.
Features
- ๐ Easy to Use: Simple API for creating and managing temporary email accounts.
- ๐ง Message Management: Full message handling with read/unread status.
- ๐ Search & Filter: Advanced search capabilities across messages.
- ๐พ Export Options: Export messages in JSON, TXT, or EML formats.
- ๐ฅ๏ธ CLI Tool: Full-featured command-line interface.
- ๐ Auto-monitoring: Monitor accounts for new messages with callbacks.
- ๐ก๏ธ Error Handling: Comprehensive error handling with retry logic.
- ๐ Statistics: Get detailed account and message statistics.
- โ๏ธ Configurable: Extensive configuration options.
- ๐ฏ Type Hints: Full type annotation support.
Installation
You can install TemMail using pip:
pip install temmail
For development, you can install the extra dependencies:
pip install temmail[dev]
Package Structure
The project is organized like this:
temmail/
โโโ temmail/
โ โโโ __init__.py
โ โโโ cli.py
โ โโโ core.py
โ โโโ exceptions.py
โ โโโ config.py
โ โโโ models.py
โ โโโ utils.py
โโโ tests/
โ โโโ __init__.py
โ โโโ test_core.py
โ โโโ test_cli.py
โ โโโ test_config.py
โโโ docs/
โ โโโ README.md
โ โโโ CHANGELOG.md
โ โโโ LICENSE
โโโ pyproject.toml
โโโ setup.cfg
โโโ setup.py
โโโ MANIFEST.in
โโโ .gitignore
Usage
TemMail offers both a powerful Python API and a comprehensive Command-Line Interface (CLI) to manage temporary email accounts.
Python API Examples
Here are some examples of how to use the Python API:
from temmail import get_temp_email, wait_for_message, TemMailAccount
# 1. Create a temporary email account
account: TemMailAccount = get_temp_email()
print(f"Your temporary email: {account.email}")
# 2. Get and manage messages
messages = account.get_messages()
print(f"Received {len(messages)} messages")
if messages:
# Mark the first message as read
messages[0].mark_as_read()
print(f"Marked message '{messages[0].subject}' as read.")
# 3. Wait for a specific message
def is_verification(msg):
return "verify" in msg.subject.lower()
print("Waiting for a verification email...")
message = wait_for_message(account, timeout=60, filter_func=is_verification)
if message:
print(f"Got verification email: {message.subject}")
else:
print("No verification email received within the timeout.")
# 4. Search messages
search_results = account.search_messages(query="important", field="subject")
print(f"Found {len(search_results)} messages with 'important' in subject.")
# 5. Get account statistics
stats = account.get_stats()
print(f"Account statistics: Total messages: {stats.total_messages}, Unread: {stats.unread_messages}")
# 6. Delete the account (use with caution!)
# account.delete()
# print(f"Account {account.email} deleted.")
Command-Line Interface (CLI) Examples
TemMail also comes with a powerful CLI. Here are some examples:
# 1. Create a new temporary email account
temmail create
# 2. Monitor for new messages and open the first one automatically
temmail monitor --stop-first --auto-open
# 3. List all unread messages
temmail messages --unread
# 4. Search messages by subject containing "password"
temmail search "password" --field subject
# 5. Export all messages to a JSON file
temmail export -o messages.json --format json
# 6. Get information about the current account
temmail info
# 7. Delete the current temporary email account (use with caution!)
# temmail delete --yes
Documentation
For more detailed information, please refer to the official documentation.
Contributing
Contributions are welcome! If you'd like to contribute to the project, please follow these steps:
- Fork the repository on GitHub.
- Create a new branch with a descriptive name.
- Make your changes and commit them with a clear message.
- Push your changes to your fork.
- Create a pull request to the main repository.
License
This project is licensed under the MIT License. See the LICENSE file for more details.ile for details.
Documentation
Full documentation is available at https://temmail.readthedocs.io
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 temmail-2.1.0.tar.gz.
File metadata
- Download URL: temmail-2.1.0.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82542974a96a56773951b6479076e90d99d495ae471c3968879aa5b3b6bcbeac
|
|
| MD5 |
02aadfd298320c44cfa4e196f7d07612
|
|
| BLAKE2b-256 |
f4a417dd5fe7abe2493b1cef583978f132ceb31c7a645db7ceb46a829156bc29
|
File details
Details for the file temmail-2.1.0-py3-none-any.whl.
File metadata
- Download URL: temmail-2.1.0-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0c86084c4b49bbe710c50c420f744ed4b2902ae2adec448eac2284a1331cc19
|
|
| MD5 |
3e7bcd0b9b7e773bf097bf172a24c81f
|
|
| BLAKE2b-256 |
c9ac89c12deaf3cff1e475ef50dd02429b5558adae8442e5bd29316c8271cb5a
|