Emailnator
Emailnator is a Python wrapper for the Emailnator temporary email service. It provides a convenient way to generate temporary email addresses, retrieve inbox messages, and fetch individual messages.
Installation
To install the Emailnator package, simply run:
pip install emailnator
TODO
- Exapand temporary email service providers
- CLI to get an email and inbox of the email in from the terminal
- Add Logging
- Expand the errors for better event capture
- Add a proxy?
To install the Emailnator package for development purposes, follow these steps:
- Clone the repository to your local machine using the command:
git clone https://github.com/repollo/Emailnator.git
- Navigate to the cloned repository directory:
cd Emailnator
- Create a virtual environment for the project:
python -m venv venv
- Activate the virtual environment:
source venv/bin/activate
Note: If you are using Windows, use the following command instead:
venv\Scripts\activate
- Install the required dependencies using pip:
pip install -r requirements.txt
- Install the package in development mode:
pip install -e .
This will install the package in editable mode, allowing you to modify the source code and see the changes reflected immediately.
Usage
First, import the Emailnator class:
from emailnator import Emailnator
Then, create an Emailnator instance:
emailnator = Emailnator()
By default, the .env file containing authentication tokens will be created in the same directory as the emailnator.py file. You can specify a custom directory using the env_path parameter:
custom_path = "/path/to/your/custom/directory"
emailnator = Emailnator(env_path=custom_path)
Generate a temporary email address
email_data = emailnator.generate_email()
email_address = email_data["email"][0]
print(email_address)
Retrieve inbox messages
inbox_data = emailnator.inbox(email_address)
print(inbox_data)
Get a specific message
message_id = inbox_data["messageData"][3]["messageID"]
message_data = emailnator.get_message(email_address, message_id)
print(message_data)
Example
from emailnator import Emailnator
emailnator = Emailnator()
# Generate an email
email_data = emailnator.generate_email()
email = email_data["email"][0]
# Get existing email if generated before.
email = emailnator.get_existing_email()
# Get email inbox of email
emails = emailnator.inbox(email)
# Select a specific email message id
message_id = emails["messageData"][1]["messageID"]
# Get the email message id contents
email_content = emailnator.get_message(email, message_id)
License
This project is licensed under the MIT License.
Metadata
Release files for emailnator 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| emailnator-0.1.1.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| emailnator-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / emailnator-0.1.1.tar.gz
| Download URL | emailnator-0.1.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0317f1342d578a0814a444a01fa3545ed0bd37dfd390e6b1875e66f1eb3cac91
|
|
BLAKE2b-256 checksum How to use checksums |
acf9f23791ca6dc57185b997f1815bfafd01e1ee8a44164e5dfe8d5613c1401f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / emailnator-0.1.1-py3-none-any.whl
| Download URL | emailnator-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f76549197c3cf90ba237bcbaab5f3d12598c4bd0426b1843e5f8f406cc97db8
|
|
BLAKE2b-256 checksum How to use checksums |
7a7d5f2c93921691ed57332f2c423a3c1e3c1e7aca09ac0fbce1c286d0cde5a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|