Skip to main content

A Python wrapper for the Emailnator temporary email service.

Project description

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

To install the Emailnator package for development purposes, follow these steps:

  1. Clone the repository to your local machine using the command:
git clone https://github.com/repollo/Emailnator.git
  1. Navigate to the cloned repository directory:
cd Emailnator
  1. Create a virtual environment for the project:
python -m venv venv
  1. Activate the virtual environment:
source venv/bin/activate

Note: If you are using Windows, use the following command instead:

venv\Scripts\activate
  1. Install the required dependencies using pip:
pip install -r requirements.txt
  1. 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.

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

emailnator-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

emailnator-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file emailnator-0.1.1.tar.gz.

File metadata

  • Download URL: emailnator-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for emailnator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0317f1342d578a0814a444a01fa3545ed0bd37dfd390e6b1875e66f1eb3cac91
MD5 01bb12d6d44ebcc0b03442ea5b8eedd1
BLAKE2b-256 acf9f23791ca6dc57185b997f1815bfafd01e1ee8a44164e5dfe8d5613c1401f

See more details on using hashes here.

File details

Details for the file emailnator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: emailnator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for emailnator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f76549197c3cf90ba237bcbaab5f3d12598c4bd0426b1843e5f8f406cc97db8
MD5 466432d7fb3ed0684943f6dd01f2948f
BLAKE2b-256 7a7d5f2c93921691ed57332f2c423a3c1e3c1e7aca09ac0fbce1c286d0cde5a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page