OTP Email Template: Test It in Real Gmail and iCloud Inboxes

A good OTP email template is short: the code near the top, how long it lasts, what to do if the user did not ask for it, sent from a domain with SPF, DKIM and DMARC in place. To prove it reaches people, send it to real @gmail.com and @icloud.com inboxes and time the arrival.

Developers and product teams who send sign-up or login codes will find here a template to copy, the sender rules Gmail and iCloud publish, and an automated loop to run after every template or DNS change. For a manual, case-by-case pass covering resends, expiry and wrong codes, use the sign-up email QA checklist.

What a good OTP email template contains

A minimal HTML body to start from:

<!-- plain-text part: "Your Example code is 482913. It expires in 10 minutes." -->
<div style="font-family:Arial,sans-serif;max-width:480px;margin:0 auto;color:#111">
  <p style="font-size:16px">Your Example verification code:</p>
  <p style="font-size:32px;font-weight:bold;letter-spacing:4px;margin:16px 0">482913</p>
  <p style="font-size:14px">It expires in 10 minutes and works once.</p>
  <p style="font-size:13px;color:#555">Didn't ask for this code? Ignore this email;
     your account stays as it is.</p>
  <p style="font-size:12px;color:#777">Example Inc. · example.com</p>
</div>

The visual design matters less than the order: a person, and any software reading the message, should meet the word "code" and the digits within the first lines.

What Gmail and iCloud check before showing your code

Check Gmail (sender guidelines) iCloud Mail (postmaster page)
Authentication SPF or DKIM for every sender; SPF, DKIM and DMARC above 5,000 messages a day to Gmail accounts, with the From domain aligned Checks every inbound message with SPF and DKIM; honours the sender's DMARC policy
Infrastructure Valid forward and reverse DNS (PTR) and a TLS connection Asks bulk senders for reverse DNS and consistent sending IPs and domains
Format and identity RFC 5322 formatting; never impersonate Gmail in the From header RFC 5321 and 5322; a consistent From name and address; marketing and transactional mail kept apart
Feedback Keep the rate of users reporting your mail in Postmaster Tools below 0.3% No allow list and no feedback loop; filtering uses IP and domain reputation, content and user feedback

One practical consequence: never send codes from an @gmail.com From address through your own server. Google says Gmail is moving to a DMARC quarantine policy and that impersonating Gmail From headers might affect delivery, so expect such messages in the junk folder.

A test loop with real Gmail and iCloud inboxes

Your app is not on the service list, so rent under Any service, code ot, which is priced higher than named services; the Any service page has the rental steps and live price.

  1. Rent one order with {"service": "ot"} and one with "domain": "icloud.com" added. If iCloud answers DOMAIN_UNAVAILABLE, run Gmail alone that time.
  2. Make your app send its OTP email to each address and note the moment it sent.
  3. Poll each order every 3–5 seconds and record when the first entry arrives.
  4. Compare the code with the one your backend generated. This catches a template that renders the wrong variable.
  5. Cancel any order you stop waiting for. Cancelling before a code refunds 100%, and an order left alone refunds itself at its codeDeadlineAt (25 minutes at most) under the rental refund rules.
import time, uuid, requests

HOST = "onemail.wtf"
H = {"Authorization": "Bearer YOUR_API_KEY"}

def rent(domain):
    r = requests.post(f"https://{HOST}/v1/orders", json={"service": "ot", "domain": domain},
                      headers={**H, "Idempotency-Key": str(uuid.uuid4())}, timeout=15).json()
    return r["data"][0] if r["success"] else None  # None on DOMAIN_UNAVAILABLE, NO_MAILS_AVAILABLE...

def measure(order, send_code, limit=600):
    sent_at = int(time.time())
    expected = send_code(order["email"])  # your test hook: sends the email, returns the code it generated
    while time.time() - sent_at < limit:
        o = requests.get(f"https://{HOST}/v1/orders/{order['orderId']}", headers=H, timeout=15).json()["data"]
        if o["otp"]:
            first = o["otp"][0]
            return {"domain": o["domain"], "seconds": first["receivedAt"] - sent_at,
                    "code_ok": first["code"] == expected, "whole_email": len(first["code"]) > 80}
        if o["status"] == "cancelled":
            break
        time.sleep(4)
    requests.post(f"https://{HOST}/v1/orders/{order['orderId']}/cancel", headers=H, timeout=15)
    return {"domain": order["domain"], "seconds": None, "code_ok": False}

for domain in ("gmail.com", "icloud.com"):
    order = rent(domain)
    if order:
        print(measure(order, send_code=my_test_hook))

receivedAt is the moment Почта recorded the code, so the measured time includes a few seconds of detection on top of delivery. Compare runs with each other, not with a stopwatch.

Reading the results

What you see What it means What to do
A code within seconds and code_ok true Delivered, and the code is easy to find Keep it as your baseline
Order cancelled at the deadline, no code Nothing reached that address in time, or it was refused Read your sending logs (accepted, deferred, bounced), check SPF, DKIM and DMARC, retry once with the other inbox type
A code, but code_ok false The template shows a different or older value Fix the template variable
whole_email true No code pattern was found, so the email came back whole Put plain digits near the word "code" at the top
Fast on one inbox type, slow or missing on the other Filtering or reputation differs between Gmail and iCloud Compare against each provider's rules above

What this test cannot tell you is folder placement. You never sign in to a rented inbox, so it does not show whether the message landed in the main inbox, a tab or the junk folder. For placement, use a seed mailbox your team owns, plus Gmail's Postmaster Tools. Where an order holds the whole email, View email on the order page shows it with Preview, Text and Source tabs.

Run it after every template or DNS change

Rerun the loop when you change the template, the sending provider, the From domain or any SPF, DKIM or DMARC record, and before a launch. Store seconds per inbox type with the date, so a slower run stands out.

For context, across all Any service orders in the last 30 days, which cover many different senders, 90% received a code, typically after about 2 minutes. Your own sender should do at least as well; if it does much worse, check authentication first. Typical times for popular services are in how long a verification email takes.

Keep it to test accounts and test data, since the messages pass through a third party, and to a handful of sends per change. Rented inboxes are for verification messages, not newsletters or load tests. If you are still choosing how to send codes at all, sending vs receiving OTP APIs covers the sending side.

Frequently asked questions

Why do OTP emails go to the junk folder?

Usually authentication or reputation: SPF or DKIM failing, no DMARC record on the From domain, a new or shared sending IP, or content that reads like marketing. Gmail also weighs how many users report your mail, so keep codes in their own stream and fix authentication first.

Should an OTP email be HTML or plain text?

Send both in one message. The HTML part can look branded; the plain-text part carries the same code for clients that do not render HTML and for screen readers.

Can I see how the email renders in different mail apps?

Only partly. Where the order holds the whole email, the order page shows one rendering and its source; a client-by-client preview needs a rendering tool. This loop is about delivery, timing and whether the code can be found.

Is there a cheaper option than Any service for regular tests?

If you test often, press Add service on the rent page and send the service name, a sample email and the number of inboxes you need per day. An admin reviews each request, and a named service is usually cheaper than Any service.

Related guides

Get your verification code now

Sign up free. You are only charged when an inbox is issued. No code within 25 minutes — 100% refunded automatically.

Can't find the service you need? Use Add service on the rental page and we will add it if our infrastructure supports it.

Need a Gmail account you can sign in to, not just a code? See buy short-lived Gmail accounts · Refund and warranty