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-0.9.93.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mailpytm-0.9.93.tar.gz
Algorithm Hash digest
SHA256 1079748b54137d4cac938cb7b4d28de454563f66023bdeec797ef71bf84fcd31
MD5 39e73d1a3288412a255e264496cdad91
BLAKE2b-256 5965860c5d93d535a38c888e9ca1e5b8d39166e679ea5898e5074edac86fb94b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mailpytm-0.9.93-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-0.9.93-py3-none-any.whl
Algorithm Hash digest
SHA256 09733386141dedbcbdf5a3228b3c19d561f71d458fc4f679b0ef66e85eb95f56
MD5 f3ef0555fa151ea3602a5ab5f26a6a7a
BLAKE2b-256 f9a981119a78d7fd87cad668e5071826ef134485c1cc5c4737c489ce4f5dcb41

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