Skip to main content

Professional temporary email service wrapper with a comprehensive CLI tool.

Project description

TemMail

PyPI version Python versions License: MIT Code style: black

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:

  1. Fork the repository on GitHub.
  2. Create a new branch with a descriptive name.
  3. Make your changes and commit them with a clear message.
  4. Push your changes to your fork.
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

temmail-2.1.0.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

temmail-2.1.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

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

Hashes for temmail-2.1.0.tar.gz
Algorithm Hash digest
SHA256 82542974a96a56773951b6479076e90d99d495ae471c3968879aa5b3b6bcbeac
MD5 02aadfd298320c44cfa4e196f7d07612
BLAKE2b-256 f4a417dd5fe7abe2493b1cef583978f132ceb31c7a645db7ceb46a829156bc29

See more details on using hashes here.

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

Hashes for temmail-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0c86084c4b49bbe710c50c420f744ed4b2902ae2adec448eac2284a1331cc19
MD5 3e7bcd0b9b7e773bf097bf172a24c81f
BLAKE2b-256 c9ac89c12deaf3cff1e475ef50dd02429b5558adae8442e5bd29316c8271cb5a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page