Skip to main content

python-tempmail10

Async temporary email client for 10minemail, built on curl_cffi with browser impersonation.

Create a disposable mailbox, then poll for incoming messages — useful for automated sign-up flows, OTP retrieval, and testing email delivery.

Features

  • Fully async API (asyncio).
  • Browser TLS impersonation via curl_cffi (Chrome).
  • Optional proxy support.
  • Async context manager for automatic session cleanup.
  • Typed result objects (AccountResult, EmailResult).
  • HTML emails parsed to plain text out of the box.

Requirements

Installation

pip install python-tempmail10

From source:

git clone https://github.com/yourname/python-tempmail10.git
cd python-tempmail10
pip install -e .

Quick start

import asyncio

from tempmail import Tempmail10


async def main():
    async with Tempmail10() as tempmail:
        account = await tempmail.create_account()
        print(account)
        if not account.success:
            return

        print("Your address:", account.email_address)

        # Block until an email arrives (or timeout).
        result = await tempmail.wait_for_message(timeout=120)
        if result.success:
            print("From:   ", result.sender)
            print("Subject:", result.subject)
            print("Text:   ", result.text)
        else:
            print("No email:", result.message)


if __name__ == "__main__":
    asyncio.run(main())

Usage

Creating a client

from tempmail import Tempmail10

# Default
tempmail = Tempmail10()

# With a proxy
tempmail = Tempmail10(proxy="http://user:pass@host:port")

Tempmail10 is an async context manager. Prefer async with so the underlying HTTP session is always closed:

async with Tempmail10() as tempmail:
    ...

If you manage the lifecycle manually, call await tempmail.close() when done.

Creating a mailbox

account = await tempmail.create_account()
# AccountResult(success=True, message='success create tempmail',
#               email_address='abc123@somedomain.com')

Fetching the latest message

result = await tempmail.get_latest_message()
if result.success:
    print(result.subject, result.sender)
elif result.empty:
    print("Mailbox is empty (no messages yet)")
else:
    print("Error:", result.message)

Waiting for a message

wait_for_message polls until a message arrives, a fatal error occurs, or the timeout is reached. Empty mailboxes are retried; fatal errors (auth/network) return immediately.

result = await tempmail.wait_for_message(timeout=120, poll_interval=3)

API reference

Tempmail10(proxy: Optional[str] = None)

Method Returns Description
await create_account() AccountResult Generate a new temporary email address.
await get_latest_message() EmailResult Fetch the most recent email in the mailbox.
await wait_for_message(timeout=120.0, poll_interval=3.0) EmailResult Poll until an email arrives or timeout.
await close() None Close the underlying HTTP session.

AccountResult

Field Type Description
success bool Whether the account was created.
message str Human-readable status message.
email_address Optional[str] The generated address (on success).

EmailResult

Field Type Description
success bool Whether an email was retrieved.
message str Human-readable status message.
sender Optional[str] Sender address.
subject Optional[str] Email subject.
html Optional[str] Raw HTML body.
text Optional[str] Plain-text body (parsed from HTML).
empty bool True when the mailbox has no messages yet.

Error handling

All client methods return result objects instead of raising on network/API failures. Inspect success (and empty for EmailResult) rather than wrapping calls in try/except:

result = await tempmail.get_latest_message()
if not result.success and not result.empty:
    # Genuine error (auth, network, server): message contains details.
    print(result.message)

Disclaimer

This library interacts with a third-party service that is not affiliated with this project. Use it responsibly and in accordance with the service's terms. Intended for testing and automation, not abuse.

License

MIT

Metadata

Release files for python-tempmail10 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-tempmail10 0.1.0
File Size Uploaded
python_tempmail10-0.1.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-tempmail10 0.1.0
File Interpreter ABI Platform
python_tempmail10-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / python_tempmail10-0.1.0.tar.gz

Download URL python_tempmail10-0.1.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
acd93cc200b60797113e41aa1b186792c7416a36495e4ffa322fe726f1dc491d
BLAKE2b-256 checksum
How to use checksums
acec15c96f3199d15dc054c5a4626ed6d2d19eeceff39dd6d712689454a51f12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / python_tempmail10-0.1.0-py3-none-any.whl

Download URL python_tempmail10-0.1.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f57786f87c5a2828410db38c4efb37af8ea1246f11afdcf653c4ce378438c45f
BLAKE2b-256 checksum
How to use checksums
8e3daa4b40b69bf2ec7abb4c666a53019370b743729e5efbf95d1b901549bc3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page