Skip to main content

Python wrapper for mail.tm disposable email service

Project description

mailpytm

A Python client library for the mail.tm temporary email service API.

This package allows you to easily create disposable email accounts, fetch messages, manage tokens, and interact with the mail.tm API seamlessly.

Features

  • Create and register temporary email accounts
  • Fetch and read emails
  • Poll and wait for specific messages
  • Mark emails as read and delete them
  • Manage authentication tokens automatically

Installation

pip install mailpytm

Usage

from mailpytm import MailTMApi, MailTMAccount
from mailpytm.exceptions import TooManyRequests, RegistrationFailed

# Create a new temporary email account
account_info = MailTMApi.create_email()
print("Email Address:", account_info["address"])
print("Password:", account_info["password"])

# Use the account with MailTMAccount
with MailTMAccount(account_info["address"], account_info["password"]) as account:
    print(account.messages)  # List messages

    # Wait for an email with a subject containing 'Verification'
    try:
        message = account.wait_for_message(subject_contains="Verification", timeout=120)
        print("Found message:", message)
    except TimeoutError:
        print("No verification email received in time.")

Exceptions

Exceptions are available under mailpytm.exceptions for fine-grained error handling:

  • TooManyRequests
  • RegistrationFailed
  • TokenError
  • FetchMessagesFailed
  • FetchAccountFailed

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

License

This project is licensed under the MIT License.

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

mailpytm-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

mailpytm-1.0.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file mailpytm-1.0.0.tar.gz.

File metadata

  • Download URL: mailpytm-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for mailpytm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 42e05d19bb7e67fd785a2f9c3bef72f874d0108e4bac0d9c4eba982e8ef0e8b4
MD5 78eda3f16a11e86ce5f887c0a4a719e5
BLAKE2b-256 5711a2631bf59dac64814bcead638022553b2d3f047085e13497ba2c8a3c492b

See more details on using hashes here.

File details

Details for the file mailpytm-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mailpytm-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for mailpytm-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 678342af6125fae87982f303ad3c419ba6ec6422d6e0036d6402a6f80eeab93f
MD5 252219dea34af0578ac8e2697596ff4e
BLAKE2b-256 4db49f0f27819b5c4602cdbeb83076f8f4c660f1d266ecac5f64dafdb16b5147

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