Skip to main content

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

Examples

Receive a message (e.g. activation code)

from tempmail import EMail

email = EMail()

# ... request some email ...

msg = email.wait_for_message()
print(msg.body)  # Hello World!\n

Get all messages in the inbox

from tempmail import EMail

email = EMail(username='example', domain='1secmail.com')
inbox = email.get_inbox()

for msg_info in inbox:
    print(msg_info.subject, msg_info.message.body)

Download an attachment

from tempmail import EMail

email = EMail('example@1secmail.com')
msg = email.wait_for_message()

if msg.attachments:
    attachment = msg.attachments[0]
    data = attachment.download()

    # Print
    print(data)  # b'Hello World!\n'
    print(data.decode('utf-8'))  # Hello World!\n

    # Save to file
    with open(attachment.filename, 'wb') as f:
        f.write(data)

License

tempmail-python is licensed under the MIT License. See the LICENSE file for more information.

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

tempmail-python-2.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

tempmail_python-2.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file tempmail-python-2.0.0.tar.gz.

File metadata

  • Download URL: tempmail-python-2.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for tempmail-python-2.0.0.tar.gz
Algorithm Hash digest
SHA256 3b9f7ac170fcf842c23aa0d674221b74eba846d481a5bd27dca227d130461340
MD5 b478e4e125c06c79aba9c69676e5b65a
BLAKE2b-256 1f251de11518aed7a6d2bd4adfa5768c82510389032ed36cfc736f5a58e6145c

See more details on using hashes here.

File details

Details for the file tempmail_python-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tempmail_python-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcc67e2140a7981a7205a13bea48496c6250c9371b270d410085d8034c2b99cc
MD5 6655eac7ed7c0a53165013cf9ef8e741
BLAKE2b-256 6a5bc33eb8683aa12b7edf66b10686c425d8cc7f782ee3014fc00d3ade91d077

See more details on using hashes here.

Supported by

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