Skip to main content
File added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

MailTM Wrapper

MailTmWrapper is a Python library designed to interact with the Mail.TM API, providing an easy-to-use interface for creating temporary email accounts and managing email messages programmatically. This wrapper simplifies operations such as generating tokens, retrieving messages, and managing accounts.

🔥 Features

  • Create and manage temporary email accounts.
  • Generate tokens for authenticated API requests.
  • Fetch, read, and delete email messages.
  • Retrieve domains and account information.
  • Minimal dependencies and easy integration.
  • Supports custom proxy configurations for network flexibility.

⚙️ Installation

To install the package locally, clone the repository and run:

pip install .

You can also install it via pip from PyPI:

pip install MailTmWrapper

🔧 Usage

Importing the Package

from mailtmwrapper import MailTM

Creating an Account

You can create a temporary email account using the create_account method:

token = MailTM().create_token(email, password)
mail = MailTM(token) # token is optional

# Create a new temporary email account
account = mail.create_account()
email = account['address']
password = account['password']
print(f"Temporary email: {email}")

If you prefer, you can specify a custom email address and password:

account = mail.create_account(email="custom_address@domain.com", password="CustomPassword123?")

Generating a Token

To perform authenticated operations, generate a token using the create_token method:

token = mail.create_token(email, password)
print(f"Generated token: {token}")

Fetching Emails

Retrieve the list of email messages associated with your account:

messages = mail.get_messages()
print("Messages:", messages)

You can also fetch specific message details by ID:

message_id = messages['hydra:member'][0]['id']
message_details = mail.get_message_by_id(message_id)
print("Message details:", message_details)

Deleting Emails

Delete an email message by its ID:

message_id = "your_message_id"
success, status_code = mail.delete_message(message_id)
if success:
    print("Message deleted successfully.")
else:
    print(f"Failed to delete message. Status code: {status_code}")

Managing Accounts

Retrieve Account Information

Get account details using the get_me method:

account_info = mail.get_me()
print("Account info:", account_info)

Delete an Account

Delete the temporary email account:

success, status_code = mail.delete_account(account_id="your_account_id")
if success:
    print("Account deleted successfully.")
else:
    print(f"Failed to delete account. Status code: {status_code}")

Working with Domains

Retrieve Available Domains

Fetch the list of domains supported by Mail.TM:

domains = mail.get_domains()
print("Domains:", domains)

Fetch Domain Details

Get details of a specific domain by its ID:

domain_id = "your_domain_id"
domain_details = mail.get_domain_by_id(domain_id)
print("Domain details:", domain_details)

Full Example

Here is a full example combining account creation, token generation, and email fetching:

from mailtm_wrapper import MailTM

mail = MailTM()

# Create a temporary account
account = mail.create_account()
email = account['address']
password = account['password']
print(f"Temporary email: {email}")

# Generate a token
token = mail.create_token(email, password)
print(f"Generated token: {token}")

# Fetch messages
messages = mail.get_messages()
print("Messages:", messages)

# Retrieve message details
if messages['hydra:member']:
    message_id = messages['hydra:member'][0]['id']
    message_details = mail.get_message_by_id(message_id)
    print("Message details:", message_details)

# Delete the account
success, status_code = mail.delete_account(account_id=account['id'])
if success:
    print("Account deleted successfully.")
else:
    print(f"Failed to delete account. Status code: {status_code}")

❗ Requirements

MailTmWrapper requires:

  • requests to send requests to the Mail.TM API. To install dependencies manually, run:
pip install requests

©️ License

MailTmWrapper is licensed under the MIT License. See the LICENSE file for more details. Mail.TM.

🖥️ Contributing

Contributions are welcome! Feel free to fork the repository, make changes, and submit a pull request.

👤 Author

MailTmWrapper is developed and maintained by sexfrance. Mail.TM is developed and maintained by MailTM.

Metadata

Release files for MailTmWrapper 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for MailTmWrapper 0.0.6
File Size Uploaded
mailtmwrapper-0.0.6.tar.gz 4.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for MailTmWrapper 0.0.6
File Interpreter ABI Platform
mailtmwrapper-0.0.6-py3-none-any.whl Python 3 none any Details
MailTmWrapper-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 15.2 kB

Release files / mailtmwrapper-0.0.6.tar.gz

Download URL mailtmwrapper-0.0.6.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
97a9378f42341b71bf619bf55a039112a6ea460df02feff27917baf646be30c3
BLAKE2b-256 checksum
How to use checksums
d1ae67182071e6bcd19ab84f55c739a74642fabe2e5eb859b988c5d7b7d17c15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / mailtmwrapper-0.0.6-py3-none-any.whl

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL mailtmwrapper-0.0.6-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61a18399ede9574040ea1e9b65086606360eadade96dfdcfb59989d39ea0ae3c
BLAKE2b-256 checksum
How to use checksums
efe3fdf88651644b6a0cd48e4938cdc36721d3ec3c125513828a5cfa3bdf0a23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / MailTmWrapper-0.0.6-py3-none-any.whl

Download URL MailTmWrapper-0.0.6-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df27038585bcfaf2699b66e1650ddce433d15bb11302ececc080e2a5d9203358
BLAKE2b-256 checksum
How to use checksums
b8fde0786d5d2680fe63d24e066f7ca795ec5b6682de2a2dc5c20a5d46dcf001
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.0.6 This release

3 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page