Skip to content
nofeb

What is OTP extraction?

Also called one-time code extraction

OTP extraction is pulling a one-time passcode, such as a six-digit verification code, out of an email automatically so software can use it without parsing the message. An email API that extracts codes returns them as fields, often with the verification and magic links found in the same message.

Checked against the engine on .

How does OTP extraction work?

Sign-up, two-factor and password-reset mail all carry the same few things: a code, a verify link, a magic-login link or a reset link. Extracting them on the server spares every test suite and agent its own regular expressions, which break when a sender changes its template.

Waiting matters as much as extracting. Polling an inbox every few seconds is slow and flaky in CI; a long-poll that returns as soon as a matching message arrives removes both the sleep and the race.

Codes and links as fields
"otps":  [{ "code": "482913", "source": "body" }],
"links": [{ "url": "https://example.com/verify?t=…", "kind": "verify" }]

How does nofeb use OTP extraction?

  • Every message nofeb stores carries otps (each code with whether it came from the subject or the body) and links classified as verify, magic_login, password_reset, unsubscribe or other.
  • wait_for_email long-polls an inbox for up to a minute, filtered by sender, subject or has_otp, and returns the message with those fields already filled. Pass since so a code that arrived while the form was submitting is not missed.

Frequently asked questions

How do I read an email OTP in Playwright or Cypress?

Create a disposable inbox per test, type its address into the form, then call wait_for_email with has_otp=true and read otps[0].code. See the Playwright guide for a complete test.

What if the email has a link instead of a code?

Read links and pick the one whose kind is verify or magic_login.

Status of everything on this page

Every capability named above, with its status as reconciled against the engine.

CapabilityWhat it doesStatus
One-time code and link extraction Verification codes and classified links are pulled out of every message and returned as fields. Shipped
Wait for an email Long-poll an inbox for up to a minute until a message matching sender, subject or has-a-code arrives. Shipped
Disposable inboxes with a time to live Give an inbox a lifetime in seconds; it and its mail are removed when it expires, and an event says so. Shipped