Pytest email testing
Use PostMX in pytest for email-aware Python tests
Create inbox fixtures, wait for messages, and extract OTP codes or links from real email without bolting a mailbox UI into your test runs.
No credit card required ยท Start free in minutes
Python flow
from postmx import PostMXSync
postmx = PostMXSync("pmx_live_...")
inbox = postmx.create_temporary_inbox({"label": "signup-test"})
print(inbox["email_address"])
message = postmx.wait_for_message(inbox["id"])
print(message["otp"])Start building today
Keep Python tests close to real email
Receive the message, pull out the data you need, and keep your pytest runs deterministic.