
Testing Email Deep Links Without a Real Phone
Need a disposable inbox right now?
Spin up a temporary email address in seconds — no signup, no spam, no trace.
Password resets, invite links, "open in app" buttons — a lot of mobile apps hand the real work back to an email. The link in that email carries a signed, single-use token the backend generated at send time, and it's supposed to open the app directly on the right screen instead of a browser. Most test suites never touch that path. They stub the email service, assert that a "send" function was called, and move on. The actual link — the thing a real user actually taps — never gets built, delivered, or opened. That's where deep link bugs live.
Why deep link bugs survive your test suite
Deep links fail in ways that unit tests can't see. The token encoding breaks when it hits a real mail transfer agent and gets wrapped or re-escaped. The custom scheme (myapp://verify?token=...) gets rewritten by an email client's link-safety scanner into an https:// redirect, and the redirect chain drops a query parameter. The associated-domain file on your web server doesn't match what iOS expects, so the universal link opens Safari instead of the app. None of that shows up when you mock the send and assert on a function call — it only shows up when a token is generated, mailed, delivered, and actually opened by something that behaves like a phone.
That's the gap: generating the link is easy to test, and so is the screen the app shows after opening it. The round trip in between — mail delivery plus a real tap-through — is the part teams skip, and it's the part most likely to regress silently after a backend refactor touches the token signer or an infra change touches the mail provider.
What a real deep link test needs
Three ingredients, all of which a mocked inbox can't give you:
A real, addressable inbox the app's backend will actually send to — not a stub that swallows the call.
A real poll-and-read step that waits for mail to arrive, the same way a user would check their phone.
A way to open the extracted link outside a browser tab, the way an OS actually hands a URL to an installed app via an intent filter or an associated domain.
Skip any of the three and you're testing something adjacent to the real flow, not the flow itself.
Wiring a disposable inbox into the test
CyberTemp's API gives you the first two pieces without any setup call. Reading an inbox creates it if it doesn't exist yet, so a fresh address is ready the moment you generate it:
import httpx, re, timeAPI_KEY = "tk_..." HEADERS = {"X-API-Key": API_KEY} BASE = "https://api.cybertemp.xyz"
def poll_for_deep_link(email, timeout=30, interval=2): deadline = time.time() + timeout pattern = re.compile(r"(myapp://[^\s"<]+|https://link\.yourapp\.com/[^\s\"<]+)") while time.time() < deadline: resp = httpx.get(f"{BASE}/getMail", params={"email": email}, headers=HEADERS) resp.raise_for_status() for message in resp.json(): match = pattern.search(message.get("body", "")) if match: return match.group(1) time.sleep(interval) raise TimeoutError(f"no deep link arrived for {email} within {timeout}s")
test_email = "[email protected]"
trigger your app's "send verification" action against test_email here
link = poll_for_deep_link(test_email)
Give each run a unique local part (deeplink-run-4471, a UUID, a CI build number) instead of reusing one address across test runs. Reused inboxes pick up stale messages from the previous run, and a regex match against the wrong email produces a false pass. A per-run address also means you're not racing a cleanup job against your own test.
Back off between polls instead of hammering the endpoint in a tight loop — a short sleep between reads is enough, and it matches how handling rate limits and retries works against the same API.
Opening the link like a phone would
Extracting the URL only proves the backend built something that looks like a link. It doesn't prove the app will open to the right screen, because the thing most likely to break — an intent filter that doesn't match the final redirected URL, or an associated-domain file that's missing the new path — only shows up when something actually hands the URL to the OS.
On an Android emulator, that's one shell command against a running instance:
adb shell am start -a android.intent.action.VIEW -d "myapp://verify?token=abc123"
On an iOS simulator:
xcrun simctl openurl booted "myapp://verify?token=abc123"
Run either one from your CI job right after poll_for_deep_link returns, then assert against whatever your UI framework uses to check the current screen — Appium's current_activity on Android, or a visible-element check for the post-verification screen on iOS. If the app lands on a 404 or the system's default browser instead of the app, you've caught the exact bug a real user would hit, days before they hit it.
Handling the fallback code in the same email
Most deep link emails also carry a fallback — a six-digit code for the case where the link doesn't work, or where the user is reading mail on a different device than the one with the app installed. Test both paths from the same message instead of writing two separate email flows:
otp_pattern = re.compile(r"\b(\d{6})\b")
def extract_both(body): link = re.search(r"myapp://[^\s"<]+", body) code = otp_pattern.search(body) return (link.group(0) if link else None, code.group(1) if code else None)
If your suite is already in Go, the SDK's WaitForOTP helper does the polling and code extraction in one call — worth a look if you're maintaining more than a couple of these flows, though it's a Pro-tier-and-up feature. Either way, assert that both the link and the fallback code are present and usable; a backend change that silently drops the fallback code is the kind of regression that only surfaces in a support ticket, not a crash log. For the login side of this same pattern, testing magic link login flows with a disposable inbox covers the web-link case in more depth, and the general polling pattern is also covered in getting OTP codes into Playwright and Cypress tests.
Clean up after the run
Once the assertion passes, delete the inbox instead of letting it sit:
curl -X DELETE "https://api.cybertemp.xyz/[email protected]" \
-H "X-API-Key: tk_..."
That frees the slot against your plan's concurrent-inbox limit, which matters once deep link tests are running on every PR instead of once a week by hand.
Bottom line
A deep link is only "tested" once something has actually clicked it — sending a mock function call or regex-checking a URL shape isn't the same thing. The fix is cheap: a unique disposable inbox per run, a poll loop instead of a hard-coded sleep, and an emulator or simulator command to hand the extracted link to the OS the way a real tap would. If you're running this across more than a handful of CI jobs — nightly regression suites, per-PR checks, multiple app flavors — the paid tiers raise the concurrent-inbox and request-rate ceilings before they become the bottleneck. Sign up if that's the stage you're at.