Python library for generating and managing temporary email addresses.
Project description
Python Temp Email Library
tempmail-python is a Python library for generating and managing temporary email addresses using the 1secmail service. It provides functions for creating email addresses, checking for new messages, and retrieving message contents.
Installation
You can install tempmail-python using pip:
pip install tempmail-python
Or you can install it from source:
pip install git+https://github.com/cubicbyte/tempmail-python.git
Usage example
import tempmail
# Create a new email address
email = tempmail.get_email()
print(email)
# Wait for a new message
msg = tempmail.wait_for_message(email)
print(msg['body'])
Output:
# vhpeptbsne@1secmail.com
# Hello World!
Using message filters:
import tempmail
email = tempmail.get_email()
print(email)
# Wait for a new message from a specific sender
msg = tempmail.wait_for_message(email, filter=lambda m: m['from'] == 'no-reply@example.com')
print(msg['body'])
API
tempmail.get_email(username=None, domain=None)
: Generate a new email address.tempmail.get_inbox(email)
: Retrieve a list of message IDs for the specified email address.tempmail.get_message(email, id)
: Retrieve the contents of a message with the specified ID.tempmail.wait_for_message(email, timeout=None, filter=None)
: Wait for a new message to arrive at the specified email address. You can optionally provide a timeout (in seconds) and a filter function to check the contents of the message.tempmail.DOMAINS
: List of available email domains.
License
tempmail-python is licensed under the MIT License. See the LICENSE file for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tempmail-python-1.0.0.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file tempmail-python-1.0.0.tar.gz
.
File metadata
- Download URL: tempmail-python-1.0.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 496a195b4597b13c1a4caf45aa0b8a0695390d99b394d78abe708c4eb9c3357a |
|
MD5 | e6887ef79ece22031eb88a816b295ab0 |
|
BLAKE2b-256 | 48baab5f2b58b1094472f29acd068e51436b12f1f91e7033d6f802493121a731 |
File details
Details for the file tempmail_python-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: tempmail_python-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00feb5a49fbaa76f339ad447b12cc2e39011b5ea1887b59f69d66bbd46d05bf7 |
|
MD5 | a186f1d1c7978e7f69b49aa5ef7d77ff |
|
BLAKE2b-256 | 7d5171ef6187fad741f64c99a693566ec8acc6c1a04a046f3aa95af696a013bb |