TürkiyeVPS

Emails Going to Spam? SPF, DKIM and DMARC Explained

Are your emails landing in the recipient's spam folder? What an SPF record is, what DKIM and DMARC do and why PTR (reverse DNS) matters, with sample DNS records and ways to test your setup.

7 min read

"My emails keep going to spam" is a problem almost every company hits sooner or later. Most of the time the cause isn't what you wrote but your domain's DNS settings. Before accepting a message, Gmail, Outlook and other large mailbox providers ask: "Did this really come from this domain?" The answer is written in your SPF, DKIM and DMARC records, and in the sending server's PTR (reverse DNS) record.

In this guide we explain these four concepts in plain language, with sample records for example.com, and show how to test your setup. If DNS is new to you, read what is DNS first.

Short version: SPF is the list of servers allowed to send mail for your domain. DKIM is a digital signature added to each message and verified against your domain. DMARC tells the receiver what to do when those checks fail. PTR shows which name a sending IP address belongs to. When all four are right, your chances of reaching the inbox go up noticeably.

Why do emails go to spam?

The receiving server gives every incoming message a trust score. The most common things that lower it:

  • Missing or wrong SPF record: the sending server isn't among those your domain allows.
  • No DKIM signature: there's no proof that the message wasn't altered on the way and really came from you.
  • No DMARC policy: large providers expect a DMARC record, especially from domains that send in bulk.
  • PTR mismatch: the sending IP has no reverse DNS record, or it points to a meaningless name.
  • Content and reputation: image-only messages, shortened links, lots of capitals and exclamation marks, or an IP address that has sent spam before.

The first four are technical and fixable for good.

What is an SPF record?

SPF (Sender Policy Framework) is a TXT record listing the servers authorised to send mail on behalf of your domain. The receiving server checks whether the sending IP address is on that list.

Example:

example.com.   TXT   "v=spf1 mx a:mail.example.com include:_spf.newsletter-sender.example ~all"

The parts:

  • v=spf1 — marks the record as SPF.
  • mx — the domain's MX servers may send.
  • a:mail.example.com — the IP address of this name may send.
  • include:... — pulls in another service's allowed list (for example a newsletter tool).
  • ~all — anything not listed is treated as "suspicious" (-all rejects it outright).

Common mistakes:

  • More than one SPF record: a domain must have only one SPF record. With two separate v=spf1 records, both may be treated as invalid. Add new services to the existing record with include:.
  • Forgetting the old provider: if you changed providers, add the new server and remove the one you no longer use.
  • Too many includes: SPF checks are limited in the number of DNS lookups (10); clean out unnecessary includes.

What is DKIM?

DKIM (DomainKeys Identified Mail) is a digital signature that the sending server adds to every message. The server signs the message with a private key; the receiving server verifies the signature with the public key published in your domain's DNS. If the signature checks out, the message wasn't changed in transit and really was sent on behalf of your domain.

A DKIM record is published under a selector:

selector1._domainkey.example.com.   TXT   "v=DKIM1; k=rsa; p=MIIBIjANBgkqh...IDAQAB"
  • selector1 — a name chosen by the provider, so that more than one key can be used.
  • p= — the public key itself. It's a long string; copy the value your provider gives you in full.

You don't generate DKIM yourself; the mail server does and gives you the record to publish. On our business email service, for example, the DKIM key is created for your domain during setup and the record to publish is shown in your client area.

What is DMARC?

DMARC is a policy built on top of SPF and DKIM. It says two things: what the receiver should do when the checks fail, and where to send you reports. It also checks "alignment": the domain in the message's From address must match the domain verified by SPF or DKIM.

_dmarc.example.com.   TXT   "v=DMARC1; p=quarantine; rua=mailto:[email protected]"
  • p=none — monitor only, take no action (good for a start).
  • p=quarantine — put failing messages in the spam folder.
  • p=reject — reject failing messages entirely.
  • rua= — the address that receives daily summary reports.

The recommended path: start with p=none, move to quarantine once reports show all your legitimate mail passing, and to reject when you're confident.

What is PTR (reverse DNS)?

Normal DNS turns a name into an IP address; a PTR record does the opposite, from IP address to name. Many mail servers look up the PTR record of the IP connecting to them; if there's none, or it looks like a home broadband line, they treat the mail as suspicious.

5.113.0.203.in-addr.arpa.   PTR   mail.example.com.

The PTR record isn't set in your domain's DNS panel but by the owner of the IP address. If you use a business email service, that's the provider's job. If you send mail from your own server, ask your server provider for a suitable PTR record for your IP; the name it points to should also resolve back to the same IP. We explain how IPs and DNS relate in what is an IP address.

How to test your setup

  1. Check your DNS records. On Linux or macOS, run dig TXT example.com, dig TXT _dmarc.example.com and dig TXT selector1._domainkey.example.com; on Windows use nslookup -type=TXT example.com to confirm the records are published.
  2. Read the message headers. In Gmail, choose "Show original" from a message's menu to see SPF, DKIM and DMARC results as PASS or FAIL.
  3. Use deliverability testing services. Free online tools give you a temporary address and score the message you send for SPF, DKIM, DMARC, PTR, blocklists and content. These "mail tester" style tools show a missing record at a glance.
  4. Read your DMARC reports. Reports arriving at the rua address show who is sending mail on behalf of your domain; if you see sources you don't recognise, review your SPF.

How it works on TürkiyeVPS business email

On our business email plans, our mail server publishes SPF and DKIM, and the MX record is added to your domain during setup. The service page in your client area lists the MX, SPF, DKIM and recommended DMARC records for your domain, ready to copy; if your DNS is hosted elsewhere, you just add them there. Every plan includes unlimited email accounts, webmail, IMAP/POP3/SMTP, spam filtering and an Istanbul location; plans differ only in total storage (10, 25, 50 and 100 GB).

We accept payment in USDT (TRC20); once your payment is confirmed, our team sets up your plan and hands over your accounts. If you're setting up business email for the first time, read how to create a business email; if you're thinking of switching providers, see our Google Workspace alternative and Yandex 360 alternative articles. For the domain basics, what is a domain name helps too.

Frequently Asked Questions

What is an SPF record, in short?

A TXT record that lists the servers allowed to send mail on behalf of your domain. Mail from a server not on the list is treated as suspicious.

Do I need all three: SPF, DKIM and DMARC?

Yes. SPF and DKIM verify where a message came from; DMARC decides what happens based on those results and sends you reports. Large mailbox providers want to see all three.

I added the records but my emails still go to spam. Why?

DNS changes can take a few hours to spread. After waiting, check the SPF, DKIM and DMARC results in the message headers. If all three pass, the cause may be the content, attachments or a filter on the recipient's side.

I have two SPF records. Is that a problem?

Yes. A domain should have only one SPF record. Merge all your sending sources into a single record using include:.

Where do I set the PTR record?

PTR is set by the owner of the IP address, not in your domain's DNS panel. If you use an email service, the provider handles it; if you send from your own server, ask your server provider.