Skip to content

Signing up for Discord? Some of our domains are accepted there. See which ones on the Domains page.

CyberTemp
All posts

How to Test Scheduled Emails Across Time Zones

CyberTemp6 min read

Need a disposable inbox right now?

Spin up a temporary email address in seconds — no signup, no spam, no trace.

Get a free inbox

Scheduled email is the feature that looks done in staging and breaks the moment real users spread across time zones start receiving it. A "send at 9am local time" digest, a reminder pegged to a user's set quiet hours, a drip campaign timed off signup — all of it depends on timestamp math that most test suites never actually exercise, because the one dev testing it is sitting in one time zone with one system clock.

Why this bug class survives QA

Scheduled-send logic usually stores a UTC timestamp, a user's time zone offset, and a rule ("send at 9am local"). The bug isn't in any one of those fields — it's in how they interact. A user in a zone with a half-hour offset gets rounded to the wrong hour. A user near a DST boundary gets an email an hour early or late for exactly the two weeks around the clock change. A batch job that runs hourly and computes "is it 9am somewhere right now" against a stale cached offset table sends nothing, or sends twice.

None of this shows up when you test with one account in one zone. It shows up three weeks after launch when support tickets start clustering around "why did I get this at 3am" from users in Auckland or Tehran — two zones popular test matrices skip because they're inconvenient offsets (+12:45 and +3:30 respectively) that break lazy hour-rounding logic.

Build a real time-zone matrix, not a token one

A useful test matrix isn't "test US, test UK, test somewhere in Asia." It's built around the offsets and rules that actually expose rounding and DST bugs:

  • A half-hour offset zone (India, +5:30) and a 45-minute offset zone (Nepal, +5:45) — catches any code path that assumes whole-hour offsets.

  • A zone mid-DST-transition on the test date — catches stale offset caching and "spring forward" gaps where a local time technically doesn't exist.

  • A zone on the opposite side of the international date line from your primary test zone — catches date-boundary bugs where "today" and "tomorrow" disagree between server and recipient.

  • A user who changes their stored time zone between scheduling and send — catches whether the system reads the offset at schedule time or send time, which is often undocumented and inconsistent across services.

Each case needs an inbox that actually receives the message at the actual send time, because the bug you're hunting is in the wall-clock delivery moment, not in the payload.

Scripting it against real inboxes

Faking the clock in a unit test proves your scheduling function is internally consistent. It doesn't prove the email pipeline — queue, worker, mail provider — agrees with that function about when "9am Kathmandu" actually is. For that you need a real send and a real inbox watching for it, one per test case so results don't bleed into each other.

CyberTemp's inbox creation is implicit: reading mail for an address that doesn't exist yet creates it, so a test harness can spin up one throwaway inbox per time-zone case without a separate setup call.

import httpx, time
from datetime import datetime, timezone

API_KEY = "tk_..."
HEADERS = {"X-API-Key": API_KEY}
BASE = "https://api.cybertemp.xyz"

def inbox_for_case(case_name: str) -> str:
    return f"tz-{case_name}[email protected]"

def wait_for_send(email: str, not_before: datetime, not_after: datetime, poll=15, timeout=1800):
    deadline = time.time() + timeout
    while time.time() < deadline:
        r = httpx.get(f"{BASE}/getMail", headers=HEADERS, params={"email": email})
        r.raise_for_status()
        for msg in r.json():
            received = datetime.fromisoformat(msg["received_at"]).astimezone(timezone.utc)
            if not_before <= received <= not_after:
                return msg
        time.sleep(poll)
    return None

cases = {
    "india": ("[email protected]", "+05:30"),
    "nepal": ("[email protected]", "+05:45"),
    "nz-dst": ("[email protected]", "DST transition day"),
}

The window check (not_before / not_after) matters more than the happy-path "did an email arrive" check. A message that lands three hours outside its expected window still counts as "an email arrived" if you're only checking for presence — the assertion has to be on when, not just whether.

What actually breaks, ranked by how often it bites

Across scheduled-send bugs that make it to production, a few patterns repeat. Rounding to the nearest whole hour when the user's offset isn't a whole hour — the message goes out on time for most users and thirty or forty-five minutes off for a visible minority who never file a bug report, they just unsubscribe. Reading the time zone at schedule time and never re-checking it, so a user who travels or updates their profile keeps getting messages timed for a city they left. And relative-time copy inside the email itself — "sent 2 hours ago," "starts in 30 minutes" — computed against the sender's clock instead of the recipient's, which reads as simply wrong to anyone outside the sender's zone.

Any one of these is invisible in a demo. All three show up the same week once a scheduled feature has users spread across a real geography, which is exactly why they belong in a test suite before that week arrives rather than in a support queue after.

Wiring it into CI without a two-week wait

You don't need to wait for a real DST transition to test one — set the system clock (or the application's injected "now" function, if it has one) to a date inside a known transition window and run the scheduling logic against it, then verify the resulting send time against a real inbox as above. Keep the time-zone matrix as a fixture file, not inline constants, so adding a new problem offset later is a one-line change rather than a new test file. And treat a missed delivery window the same as a failed assertion, not a flaky retry — silently retrying "no email yet" hides exactly the timing bug you're trying to catch. For the broader pattern of polling disposable inboxes reliably in CI, the OTP test automation guide and the notes on handling rate limits and retries cover the polling and backoff details this kind of suite depends on.

Scheduled-send testing shares a lot of plumbing with other timing-sensitive email flows — the same per-case throwaway inbox pattern shows up in the waitlist and queue-position testing guide, if you're building out a broader suite around time- or state-dependent email.


If you're scripting against signups for this kind of test suite — timezone matrices, DST fixtures, scheduled-send verification running on every deploy — the paid tiers are where per-key request limits stop being the bottleneck for a matrix that fans out across a dozen throwaway inboxes per run. Sign up if that's the suite you're building.

Share
    How to Test Scheduled Emails Across Time Zones | CyberTemp Blog