MailTmWrapper


NameMailTmWrapper JSON
Version 0.0.6 PyPI version JSON
download
home_pagehttps://github.com/sexfrance/MailTM-Wrapper
SummaryA Python wrapper for the Mail.tm API
upload_time2025-01-17 22:11:34
maintainerNone
docs_urlNone
authorSexfrance
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">MailTM Wrapper</h2>

**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:

```bash
pip install .
```

You can also install it via `pip` from PyPI:

```bash
pip install MailTmWrapper
```

## 🔧 Usage

### Importing the Package

```python
from mailtmwrapper import MailTM
```

### Creating an Account

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

```python
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:

```python
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:

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

### Fetching Emails

Retrieve the list of email messages associated with your account:

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

You can also fetch specific message details by ID:

```python
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:

```python
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:

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

#### Delete an Account

Delete the temporary email account:

```python
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:

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

#### Fetch Domain Details

Get details of a specific domain by its ID:

```python
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:

```python
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:

```bash
pip install requests
```

## ÂŠī¸ License

MailTmWrapper is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
[Mail.TM](https://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](https://mail.tm/) is developed and maintained by **MailTM**.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sexfrance/MailTM-Wrapper",
    "name": "MailTmWrapper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Sexfrance",
    "author_email": "bwuuuuu@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d1/ae/67182071e6bcd19ab84f55c739a74642fabe2e5eb859b988c5d7b7d17c15/mailtmwrapper-0.0.6.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">MailTM Wrapper</h2>\n\n**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.\n\n## \ud83d\udd25 Features\n\n- Create and manage temporary email accounts.\n- Generate tokens for authenticated API requests.\n- Fetch, read, and delete email messages.\n- Retrieve domains and account information.\n- Minimal dependencies and easy integration.\n- Supports custom proxy configurations for network flexibility.\n\n## \u2699\ufe0f Installation\n\nTo install the package locally, clone the repository and run:\n\n```bash\npip install .\n```\n\nYou can also install it via `pip` from PyPI:\n\n```bash\npip install MailTmWrapper\n```\n\n## \ud83d\udd27 Usage\n\n### Importing the Package\n\n```python\nfrom mailtmwrapper import MailTM\n```\n\n### Creating an Account\n\nYou can create a temporary email account using the `create_account` method:\n\n```python\ntoken = MailTM().create_token(email, password)\nmail = MailTM(token) # token is optional\n\n# Create a new temporary email account\naccount = mail.create_account()\nemail = account['address']\npassword = account['password']\nprint(f\"Temporary email: {email}\")\n```\n\nIf you prefer, you can specify a custom email address and password:\n\n```python\naccount = mail.create_account(email=\"custom_address@domain.com\", password=\"CustomPassword123?\")\n```\n\n### Generating a Token\n\nTo perform authenticated operations, generate a token using the `create_token` method:\n\n```python\ntoken = mail.create_token(email, password)\nprint(f\"Generated token: {token}\")\n```\n\n### Fetching Emails\n\nRetrieve the list of email messages associated with your account:\n\n```python\nmessages = mail.get_messages()\nprint(\"Messages:\", messages)\n```\n\nYou can also fetch specific message details by ID:\n\n```python\nmessage_id = messages['hydra:member'][0]['id']\nmessage_details = mail.get_message_by_id(message_id)\nprint(\"Message details:\", message_details)\n```\n\n### Deleting Emails\n\nDelete an email message by its ID:\n\n```python\nmessage_id = \"your_message_id\"\nsuccess, status_code = mail.delete_message(message_id)\nif success:\n    print(\"Message deleted successfully.\")\nelse:\n    print(f\"Failed to delete message. Status code: {status_code}\")\n```\n\n### Managing Accounts\n\n#### Retrieve Account Information\n\nGet account details using the `get_me` method:\n\n```python\naccount_info = mail.get_me()\nprint(\"Account info:\", account_info)\n```\n\n#### Delete an Account\n\nDelete the temporary email account:\n\n```python\nsuccess, status_code = mail.delete_account(account_id=\"your_account_id\")\nif success:\n    print(\"Account deleted successfully.\")\nelse:\n    print(f\"Failed to delete account. Status code: {status_code}\")\n```\n\n### Working with Domains\n\n#### Retrieve Available Domains\n\nFetch the list of domains supported by Mail.TM:\n\n```python\ndomains = mail.get_domains()\nprint(\"Domains:\", domains)\n```\n\n#### Fetch Domain Details\n\nGet details of a specific domain by its ID:\n\n```python\ndomain_id = \"your_domain_id\"\ndomain_details = mail.get_domain_by_id(domain_id)\nprint(\"Domain details:\", domain_details)\n```\n\n## Full Example\n\nHere is a full example combining account creation, token generation, and email fetching:\n\n```python\nfrom mailtm_wrapper import MailTM\n\nmail = MailTM()\n\n# Create a temporary account\naccount = mail.create_account()\nemail = account['address']\npassword = account['password']\nprint(f\"Temporary email: {email}\")\n\n# Generate a token\ntoken = mail.create_token(email, password)\nprint(f\"Generated token: {token}\")\n\n# Fetch messages\nmessages = mail.get_messages()\nprint(\"Messages:\", messages)\n\n# Retrieve message details\nif messages['hydra:member']:\n    message_id = messages['hydra:member'][0]['id']\n    message_details = mail.get_message_by_id(message_id)\n    print(\"Message details:\", message_details)\n\n# Delete the account\nsuccess, status_code = mail.delete_account(account_id=account['id'])\nif success:\n    print(\"Account deleted successfully.\")\nelse:\n    print(f\"Failed to delete account. Status code: {status_code}\")\n```\n\n## \u2757 Requirements\n\nMailTmWrapper requires:\n\n- `requests` to send requests to the Mail.TM API.\n  To install dependencies manually, run:\n\n```bash\npip install requests\n```\n\n## \u00a9\ufe0f License\n\nMailTmWrapper is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n[Mail.TM](https://mail.tm/).\n\n## \ud83d\udda5\ufe0f Contributing\n\nContributions are welcome! Feel free to fork the repository, make changes, and submit a pull request.\n\n## \ud83d\udc64 Author\n\nMailTmWrapper is developed and maintained by **sexfrance**.\n[Mail.TM](https://mail.tm/) is developed and maintained by **MailTM**.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python wrapper for the Mail.tm API",
    "version": "0.0.6",
    "project_urls": {
        "Homepage": "https://github.com/sexfrance/MailTM-Wrapper"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8fde0786d5d2680fe63d24e066f7ca795ec5b6682de2a2dc5c20a5d46dcf001",
                "md5": "92d5eec35fb77315c52ed667481a332c",
                "sha256": "df27038585bcfaf2699b66e1650ddce433d15bb11302ececc080e2a5d9203358"
            },
            "downloads": -1,
            "filename": "MailTmWrapper-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "92d5eec35fb77315c52ed667481a332c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5075,
            "upload_time": "2025-01-17T22:11:33",
            "upload_time_iso_8601": "2025-01-17T22:11:33.047568Z",
            "url": "https://files.pythonhosted.org/packages/b8/fd/e0786d5d2680fe63d24e066f7ca795ec5b6682de2a2dc5c20a5d46dcf001/MailTmWrapper-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1ae67182071e6bcd19ab84f55c739a74642fabe2e5eb859b988c5d7b7d17c15",
                "md5": "aa464fbdf378b6e5cedccbc0fc898297",
                "sha256": "97a9378f42341b71bf619bf55a039112a6ea460df02feff27917baf646be30c3"
            },
            "downloads": -1,
            "filename": "mailtmwrapper-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "aa464fbdf378b6e5cedccbc0fc898297",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4688,
            "upload_time": "2025-01-17T22:11:34",
            "upload_time_iso_8601": "2025-01-17T22:11:34.132990Z",
            "url": "https://files.pythonhosted.org/packages/d1/ae/67182071e6bcd19ab84f55c739a74642fabe2e5eb859b988c5d7b7d17c15/mailtmwrapper-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 22:11:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sexfrance",
    "github_project": "MailTM-Wrapper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mailtmwrapper"
}
        
Elapsed time: 1.06698s