How do I get a real inbox, receive an email, and read the OTP fast?
Start with a temporary inbox, wait for the next email, and read the extracted OTP or first link. Lifecycle controls, webhooks, retries, and routing details are still here, just moved into advanced docs.
For LLMs and coding agents: use `/llms.txt` for the compact map and `/llms-full.txt` for the expanded version.
npm install postmx
import { PostMX } from "postmx";
const postmx = new PostMX(process.env.POSTMX_API_KEY!);
const inbox = await postmx.createTemporaryInbox({
label: "signup-test",
});
const message = await postmx.waitForMessage(inbox.id);
console.log(message.otp);Get a temporary inbox, wait for the next email, and read the OTP or first link in under 2 minutes.
Read docsThe simple inbox -> message -> extracted fields flow for Node.js and TypeScript, plus advanced controls when you need them.
Read docsThe same simple flow for async and sync Python, with advanced controls moved out of the way.
Read docsPostMX
PostMX is easiest to think about as three steps: create a temporary inbox, wait for the next email, then read extracted fields like the OTP or first link.
If that is your job right now, start with Quickstart.
The Super Simple Path
- Get a real temporary inbox.
- Use its email address in your app or test.
- Wait for the next email.
- Read
message.otp,message.links, or the full message body.
waitForMessage() and wait_for_message() return the latest existing message immediately if the inbox already has one; otherwise they wait for the next incoming email until the timeout.
Pick Your SDK
- Quickstart: The fastest path for "I need an inbox and an OTP right now."
- Node.js SDK: Best for backend apps, TypeScript projects, scripts, and test automation.
- Python SDK: Best for Python backends, async workers, and test suites.
What Do You Want Back?
The default response is the full message, but content_mode is just a simple choice about what you want back:
full: subject, bodies, OTP, links, and extracted metadataotp: message metadata plus the OTPlinks: message metadata plus extracted linkstext_only: message metadata plus plain text
Official Example Repos
- postmx/node-example: End-to-end Node.js and TypeScript example app built on the PostMX SDK.
- postmx/python-example: End-to-end Python example app built on the PostMX SDK.
- Example Apps guide: Quick links, run commands, and when to choose each example.
Advanced
When you need more control, go here next:
- CLI: Terminal and CI workflows.
- REST API reference: Raw HTTP control.
- Test OTP Flows: More end-to-end examples.
- Verify Webhooks: Push delivery, signature verification, and retries.