Skip to main content

tempmailo

A small Python client for the TempMailo API: create temporary email addresses, read the mail they receive, and check the signature of webhook requests. No dependencies beyond the standard library, Python 3.10 or newer, MIT license.

Made for sign-up tests, checks of your own transactional email, and apps or bots that need a throwaway inbox. TempMailo addresses only receive mail; they cannot send.

Install

pip install tempmailo

API key

Create a free account at tempmailo.co, confirm its email and create a key on the API page of your account. Pass it to TempMailo(...) or set TEMPMAILO_API_KEY. Keep the key out of public code.

The free limits are on the API page: 100 new addresses a day, 60 requests a minute, addresses that live 10 or 60 minutes, webhooks up to 1000 events a day.

Read a confirmation code

import re
from tempmailo import TempMailo

mail = TempMailo()  # reads TEMPMAILO_API_KEY
box = mail.create(lifetime=600)
print("Sign up with", box.email)

# ... your test registers a user with box.email here ...

letter = mail.wait_for_message(box.token, timeout=120, match=lambda m: "code" in m.subject.lower())
code = re.search(r"\b\d{6}\b", letter.plain).group()
print("Code:", code)

mail.delete(box.token)

wait_for_message polls every 5 seconds by default, which keeps you far from the limit of 60 requests a minute.

Methods

Method Returns
create(lifetime=3600, domain=None, login=None, client=None) Mailbox with email, expired and the token that opens it
status(token) Status: mailbox, active, count, unread (works after the address expires)
messages(token, after=None) list of MessageSummary, newest first, up to 100
message(token, id) Message: plain, html, to, cc, reply_to, attachments; marks it read
source(token, id) the raw message as str
attachment(token, id, index) the file as bytes
delete(token) deletes the address and its mail
wait_for_message(token, timeout=120, interval=5, match=None) the first new Message that passes match
domains() domains you may pass to create, lifetimes, login rules
usage() your plan, limits and how much is used
webhook(), set_webhook(url), test_webhook(), rotate_webhook_secret(), delete_webhook() your account webhook

Message objects call the sender sender and sender_name (the API field from is a reserved word in Python). Every object keeps the full JSON it came from in raw.

Errors

Every failed call raises TempMailoError with the API code and the HTTP status. Subclasses: AuthError (401, 403), ExpiredError (410), NotFoundError (404) and RateLimitError (429, with scope, limit, reset and retry_after).

When the API asks to wait 60 seconds or less, the client waits and retries by itself (twice by default; see max_retries and max_retry_wait). A used-up daily limit is raised at once. client.last_rate_limit holds the last X-RateLimit-* headers.

Webhooks

Set an HTTPS address once, and every email to addresses made with your key comes to it as a signed POST request:

created = mail.set_webhook("https://example.com/hooks/mail")
secret = created["secret"]  # shown only once: store it

Check each request with the raw body, before you parse it:

import os

from flask import Flask, request
from tempmailo import WebhookVerificationError, verify_webhook

SECRET = os.environ["TEMPMAILO_WEBHOOK_SECRET"]
app = Flask(__name__)


@app.post("/hooks/mail")
def hook():
    try:
        # the raw bytes; in FastAPI use: await request.body()
        event = verify_webhook(SECRET, request.headers, request.get_data())
    except WebhookVerificationError:
        return "", 400
    if event.type == "message.received":
        print(event.mailbox.email, event.message.subject)
    return "", 204

The signature follows Standard Webhooks. Requests older or newer than 5 minutes are refused. The same email can come twice, so skip repeats by event.id. A full receiver on the standard library is in examples/webhook_receiver.py.

Development

pip install -e . pytest ruff mypy
pytest
ruff check . && mypy

The tests run against a local stand-in of the API and never call tempmailo.co.

License

MIT, see LICENSE. Run by WOWLINK LTD, Cyprus. Questions: tempmailo.co/contact.

Metadata

Release files for tempmailo 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 tempmailo 0.1.0
File Size Uploaded Provenance Actions
tempmailo-0.1.0.tar.gz 17.8 kB With provenance Details for tempmailo-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 31.0 kB

Release files / tempmailo-0.1.0.tar.gz

Download URL tempmailo-0.1.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
12738a25e7e1262c998759da6bcfe5059c7988b692643495697a2e6f50018373
BLAKE2b-256 checksum
How to use checksums
642e59afdbbc702713e3cb0906e3596714349c80481e4030e3b1a074692d450a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

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

Download URL tempmailo-0.1.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d757579fb402822177679a5b6e3229f97fb3bd95e68dc64fb08fbdf8ca92f97
BLAKE2b-256 checksum
How to use checksums
308e899a3e95fe184deb4217d18b151b65ee8b9dbe0c19e437048370d3ab10ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for tempmailo 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tempmailo-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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