Skip to main content

Python wrapper for https://dropmail.me API

Project description

DropMail Python Wrapper

Python wrapper for DropMail temporary email service with Mirror Support. Please scroll down to see everything, you may miss a lot of important things!

Installation

pip install dropmail

Simple Usage

from dropmail import dropmail

# Get a temporary email
email, check = dropmail()
print(f"{email}")

# Check for messages
messages = check()
for msg in messages:
    print(f"From: {msg['fromAddr']}")
    print(f"Subject: {msg['headerSubject']}")
    print(f"Message: {msg['text']}")

Wait for message

email, check = dropmail(wait=True, timeout=300)

Advanced Usage

from dropmail import dropmailplus

# Create client
client = dropmailplus()

# Create new email session
session = client.create()
print(f"Email: {session['email']}")
print(f"Session ID: {session['session_id']}")
print(f"Expires at: {session['expires_at']}")

# Wait for message
message = client.wait_for_message(session['session_id'], timeout=120)
if message:
    print(f"Received: {message['headerSubject']}")

# Get all messages
messages = client.get_messages(session['session_id'])

# Get all active sessions
sessions = client.get_all_sessions()

API Reference (SYNC)

dropmail(wait=False, timeout=300, domain=None, blocking=True)

Way to create temporary email. Parameters:

  • wait (bool): Wait for first message if True
  • domain (string): Example "dropmail.me"
  • blocking (bool): Blocking flow until get mail Returns:
  • Tuple of (email_address, check_function)

DropMail Class

dropmailplus(token=None, timeout=30)

Initialize client with optional token if "None" = autogenerate token.

create(domain=None)

Create new email with session id. Returns dict with session_id, email, emails (all), expires_at.

restore_session(session_id)

Restore session (mail) by id

get_messages(session_id, only_new=False)
  • only_new (bool): Unreaded messages only. Get all messages for session.
wait_for_message(session_id, timeout=300, poll_interval=2, filter_func=None, only_new=True)
  • filter_func (func) - filter function (example lambda msg: msg['fromAddr'] == 'test@dropmail.me') Wait for first message to arrive.
wait_for_messages(session_id, count=1, timeout=300, poll_interval=2, filter_func=None)

Waiting for multiple messages before returning them.

filter_messages(messages, from_addr=None, subject_contains=None, text_contains=None)
get_all_sessions()

Get all active sessions for current token.

API Reference (ASYNC)

async_dropmail(wait=False, timeout=300, domain=None)
async_dropmailplus(token=None, timeout=30)

Message structure (IMPORTANT)

  • fromAddr - from address
  • toAddr - to address
  • headerSubject - theme of mail
  • text - text from the mail
  • html - HTML version
  • downloadUrl - obvious
  • rawSize - size in bytes
  • receivedAt - recived time

Available domains

  • dropmail.me
  • 10mail.org
  • yomail.info
  • emltmp.com
  • emlpro.com
  • emlhub.com
  • freeml.net
  • spymail.one
  • mailpwr.com
  • mimimail.me
  • 10mail.xyz

License

MIT

Contributing

Pull requests are welcome! Please feel free to submit a Pull Request.

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

dropmail-1.0.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dropmail-1.0.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file dropmail-1.0.1.tar.gz.

File metadata

  • Download URL: dropmail-1.0.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for dropmail-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a7e3c8dbcd0af02e3b75772e2db6f71d6f715ccc7c2a3317d27b9bb5f0b02ff6
MD5 640d4629116cc524923940b8ff71d57f
BLAKE2b-256 a9969c7642dae124b78c93562c813d521600832c73976e36e5ac29ad4098ca85

See more details on using hashes here.

File details

Details for the file dropmail-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: dropmail-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for dropmail-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 453568c6ad9a8dc1bdae3b1f8af671bbae08cbcf266f6916db5bb4107db8e95c
MD5 1bca219ca2af1fb5779b8282470735e0
BLAKE2b-256 0ac52103b149331659bca368f331a054d8cb41a73fcdb9c0a4d4e997946000b7

See more details on using hashes here.

Supported by

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