> Login codes in the spam folder lose you users. Find the cause in five minutes, then fix authentication, content and abuse step by step.

Source: https://vaartix.com/blog/otp-emails-in-spam

[Blog](https://vaartix.com/blog)

# Why your OTP emails land in spam (and how to fix it in 30 minutes)

19 November 2026 · 7 min read · Vaartix team

-   [Deliverability](https://vaartix.com/blog/tag/deliverability)
-   [Developers](https://vaartix.com/blog/tag/developers)

A login code is only useful while someone is staring at your sign-in screen. If it lands in spam, they don't search for it. They tap "resend", give up, or write to your support team. Most of the time the cause is one of a short list of problems, and most of them can be fixed in an afternoon. This post walks through them in the order worth checking, with rough times for each.

## First, find out why (5 minutes)

Don't guess. Send a code to a Gmail address you control, open it, and choose **⋮ → Show original**. Near the top you'll see three lines:

```
SPF:   PASS with IP …
DKIM:  'PASS' with domain acme.in
DMARC: 'PASS'
```

What you're looking for:

-   **Any FAIL, or a line missing.** Your domain isn't fully authenticated. Start with step 1.
-   **DKIM passes, but for a different domain** (your email provider's, not yours). Your email is signed, but not as you, so DMARC can't line it up with your From address. Step 1 again.
-   **All three pass, and it's still in spam.** Authentication is fine. The problem is the content, the sending pattern or your reputation. Skip to step 3.

You can also check a domain's records without sending anything: our free [email authentication checker](https://vaartix.com/tools/email-auth-checker) reads your SPF, DKIM and DMARC records and explains, in plain English, what's wrong with them.

## 1\. Authenticate your domain (10 minutes, plus DNS time)

Unauthenticated email is the most common reason codes land in spam. Gmail and Yahoo have required every sender to authenticate since February 2024. Anyone sending more than 5,000 emails a day to Gmail addresses must have SPF, DKIM and DMARC, and keep spam complaints below 0.3%. Outlook brought in similar rules for high-volume senders in 2025.

Three records do the work:

-   **SPF** lists the servers allowed to send for a domain. It's checked against the hidden return path (where bounces go), not the From address people see.
-   **DKIM** signs every email. The receiving server checks the signature against a public key in your DNS.
-   **DMARC** checks that SPF or DKIM passed *for the same domain as your From address*, and tells receivers what to do if not.

With Vaartix, adding a domain gives you the exact records to publish. For `acme.in` they look like this:

| Type | Name | Value |
| --- | --- | --- |
| TXT | `vaartix._domainkey.acme.in` | `v=DKIM1; k=rsa; p=MIIBIjANBgkqh…` |
| MX (10) | `vxmail.acme.in` | `feedback-smtp.ap-south-1.amazonses.com` |
| TXT | `vxmail.acme.in` | `v=spf1 include:amazonses.com ~all` |
| TXT | `_dmarc.acme.in` | `v=DMARC1; p=none;` |

The `vxmail` records are your return path: bounces go to a subdomain of your own domain, so SPF lines up with your From address. Your main domain's MX records and inbox don't change. The full walkthrough is in [Verify your domain](https://vaartix.com/docs/domains/verify/), and [Add DNS records at your provider](https://vaartix.com/docs/guides/dns-providers/) has steps for GoDaddy, Hostinger, Cloudflare and others.

The mistake we see most often: typing the full name (`vxmail.acme.in`) into a DNS panel that adds your domain on the end, which creates `vxmail.acme.in.acme.in`. If your provider shows your domain next to the name box, enter only `vxmail` (or `vxmail.mail` when you send from `mail.acme.in`). Your domain's page in the dashboard shows exactly what to type.

## 2\. Add a DMARC record (2 minutes)

If you have no DMARC record at all, add one now. Start with monitoring only:

```
_dmarc.acme.in.  TXT  "v=DMARC1; p=none; rua=mailto:dmarc@acme.in"
```

`p=none` changes nothing about delivery, but it satisfies the mailbox providers' rules, and the reports sent to the `rua` address show every service sending as your domain. A domain can only have one DMARC record, so if one exists already, keep it. Once the reports are clean for a few weeks, move to `p=quarantine` and then `p=reject`. [Tighten DMARC safely](https://vaartix.com/docs/guides/spf-dkim-dmarc/#tighten-dmarc-safely) explains how.

## 3\. Look like the same sender every time (5 minutes)

-   **Send from a subdomain**, such as `login@mail.acme.in`. Mailbox providers track reputation per domain, so a problem with your app's email won't drag down your team's everyday email, or the other way round.
-   **Use one From name and address** for codes, always. `Acme <login@mail.acme.in>` is easy to recognise and easy for filters to learn.
-   **Write a plain, specific subject.** `482913 is your Acme login code` beats `Important: action required!!!`, and puts the code in the notification preview, so many people never need to open the email.

## 4\. Keep the email small and plain (5 minutes)

A code email needs three things: the code, how long it's valid for, and what to do if they didn't ask for it. Everything else is a risk.

-   **Always send a text version** alongside any HTML.
-   **No URL shorteners.** bit.ly and similar links are heavily used by spammers. Link only to your own domain, or not at all.
-   **No images of text, no scripts, no forms.** Filters can't read images, and many inboxes block them.
-   **No open or click tracking on codes.** Tracked links point to a different domain, which looks suspicious in a security email. In Vaartix, tracking is off unless you turn it on for a domain or a single email, so leave it off here.

With the Node.js SDK, a complete login code email looks like this:

```
import { Vaartix } from 'vaartix';

const vaartix = new Vaartix(process.env.VAARTIX_API_KEY);

await vaartix.emails.send(
  {
    from: 'Acme <login@mail.acme.in>',
    to: user.email,
    subject: `${code} is your Acme login code`,
    text: `Your code is ${code}. It expires in 10 minutes.\nIf you didn't ask for it, ignore this email.`,
  },
  { idempotencyKey: `login-${attemptId}` },
);
```

The idempotency key means a network retry won't send two different codes. More good practice for codes is on the [OTP emails page](https://vaartix.com/use-cases/otp-emails).

## 5\. Stop bots from using your login form (10 minutes)

This one is easy to miss. Bots sometimes use sign-up and login forms to send codes to thousands of addresses they don't own. The bounces and spam complaints that follow damage your domain's reputation quickly, and then your real users' codes go to spam too.

-   Put a CAPTCHA (such as Cloudflare Turnstile or reCAPTCHA) on every form that sends a code.
-   Limit codes per email address and per IP address, for example 5 an hour.
-   On login, only send a code to an address that already has an account, not to anything typed into the box.

## 6\. Never send twice to an address that bounced

Mailbox providers notice when you keep sending to addresses that don't exist. Vaartix does this part for you: hard bounces and spam complaints are [suppressed automatically](https://vaartix.com/docs/concepts/suppression/), so later emails to those addresses are skipped. Listen for the `email.bounced` webhook too, so you can tell the person on screen that their address didn't work and ask them to check it.

## Check it worked

Send yourself another code and look at **Show original** again. You want `PASS` on all three lines, with DKIM passing for *your* domain. Then try a couple of other inboxes, such as Outlook and Yahoo, if your users use them.

## What takes longer than 30 minutes

Authentication and content are quick fixes. Reputation builds slowly:

-   **A brand-new domain** that suddenly sends thousands of emails looks suspicious. Let volume grow with your real traffic over a few weeks.
-   **Watch the signals.** [Google Postmaster Tools](https://postmaster.google.com/) is free and shows your domain's reputation and spam rate at Gmail, which handles a large share of personal email in India.
-   **Keep complaints low.** Only email people who asked for it. A login code nobody requested is exactly what gets reported as spam.

For the full checklist, see [Keep your emails out of spam](https://vaartix.com/docs/guides/avoid-spam/) in the docs, and [SPF, DKIM and DMARC explained](https://vaartix.com/docs/guides/spf-dkim-dmarc/) for the detail behind step 1.

## Related posts

-   [Sending OTPs: delays, retries and what users actually see](https://vaartix.com/blog/otp-email-delays) 30 November 2026
-   [Hard bounces, soft bounces and complaints: what each one means for your reputation](https://vaartix.com/blog/bounces-and-complaints) 24 November 2026
-   [Send email from your AI assistant with the Vaartix MCP server](https://vaartix.com/blog/connect-ai-assistant-mcp) 29 November 2026

**Vaartix is a transactional email API built in India.** It sends through Amazon SES in Mumbai, keeps your data in India and is priced in rupees. Anyone can sign up free, and the Free plan has every feature.

[Sign up free](https://app.vaartix.com/?signup)
