Skip to main content
Inbox, message, extracted fields

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.

Quickest path to value
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);

PostMX

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

  1. Get a real temporary inbox.
  2. Use its email address in your app or test.
  3. Wait for the next email.
  4. 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 metadata
  • otp: message metadata plus the OTP
  • links: message metadata plus extracted links
  • text_only: message metadata plus plain text

Official Example Repos

Advanced

When you need more control, go here next: