Instant temporary @gmail.com addresses from your terminal.
No browser. No API key. No dependencies.
Most temp-mail CLIs rely on a headless Chromium browser (Puppeteer/Playwright) just to bypass Cloudflare and grab a session token. That's slow, heavy, and overkill.
tempgmail reverse-engineered the Emailnator REST API and hits it directly with native fetch — no browser, no native addons, no node_modules.
npm install -g tempgmailOr run without installing:
npx tempgmail newtempgmail new [amount] [options] Generate new temp email(s)
tempgmail list Show previously generated emails
tempgmail clear Clear email history
tempgmail inbox <email> List messages in an inbox
tempgmail read <email> <msgId> Read a specific message
tempgmail otp <email> Wait and print the first OTP found
$ tempgmail new
Creating 1 email(s)...
✓ Success!
combtmp+e1kae@gmail.com -> https://emailnator.com/inbox/combtmp+e1kae@gmail.com$ tempgmail new 3$ tempgmail new --dot # dot.in.address@gmail.com style
$ tempgmail new --plus # address+suffix@gmail.com style
$ tempgmail new --google # address@googlemail.com style
$ tempgmail new --domain # custom domain
$ tempgmail new --dot --plus # combine multiple$ tempgmail inbox combtmp+e1kae@gmail.com$ tempgmail otp combtmp+e1kae@gmail.com
# Waits up to 120s by default, prints the code when it arrives
$ tempgmail otp combtmp+e1kae@gmail.com --timeout=60$ tempgmail list # see all previously generated addresses
$ tempgmail clear # wipe historyimport {
getSession,
generateEmail,
getInbox,
getMessage,
waitForOTP,
createAndWaitOTP,
} from "tempgmail";
// One-liner: create + wait for OTP
const { email, waitForOTP } = await createAndWaitOTP();
console.log("Email:", email);
// Register on a service using `email`, then:
const otp = await waitForOTP({ timeout: 120_000 });
console.log("OTP:", otp);| Function | Description |
|---|---|
getSession() |
Returns { cookies, xsrf } — a fresh session |
generateEmail(session, types?) |
Returns a new @gmail.com address |
getInbox(session, email) |
Returns array of messages |
getMessage(session, email, messageId) |
Returns full message body |
waitForOTP(session, email, options?) |
Polls inbox and returns first OTP match |
createAndWaitOTP(options?) |
Convenience wrapper for the full flow |
{
timeout: 120_000, // ms to wait before throwing (default: 120s)
interval: 4_000, // polling interval in ms (default: 4s)
pattern: /\b\d{4,8}\b/ // regex to extract code (default: 4-8 digit number)
}GET https://emailnator.com/— grab session cookie +XSRF-TOKENPOST /api/generate-email— create a fresh disposable addressPOST /api/inbox— poll for new messagesPOST /api/message-list— read message body, extract OTP via regex
Everything runs in a single Node.js process. No Chromium. No native modules.
- Node.js ≥ 18 (native
fetch+getSetCookie())
MIT — see LICENSE