Skip to main content

A Python wrapper for the Mail.tm API

Project description

Discord Username Checker

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 logmagix

🔧 Usage

Importing the Package

from mailtmwrapper import MailTM

Creating an Account

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

mail = MailTM()

# 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.

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

mailtmwrapper-0.0.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

MailTmWrapper-0.0.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file mailtmwrapper-0.0.3.tar.gz.

File metadata

  • Download URL: mailtmwrapper-0.0.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for mailtmwrapper-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b66c5e9e9cf3e8a581cffb44257bdb7d03b8897c00bbd1bd26a2465aee27ed89
MD5 79c9164b0606d2206f887b7a88f9d3b3
BLAKE2b-256 b293feb49bc78ede755246eefd50a4cad99ead6d6594a1956c05daa797067e35

See more details on using hashes here.

File details

Details for the file MailTmWrapper-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: MailTmWrapper-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for MailTmWrapper-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e80019874d93f26537aa9b2fc0b682a0f07ffe21d7ac87dd326e4310d2d2d7ef
MD5 2250e0ab6fe4be51f0ae531815b76fd8
BLAKE2b-256 7df443fc1a6b56c292ce366e371a56ea6837844008d191407544c6a0a0bad8f3

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