Guest mode. You can read posts without signing up. Comments, ratings, job contacts and your own posts open after you sign up and accept the rules. What is Kommit →

Редакция КоммитРедакция портала
commit e6a47ff · 15 days ago

Corporate Mail, Part 2: Domain and DNS — MX, SPF, DKIM, DMARC, PTR, MTA-STS, and Deliverability Verification

🌐 Machine-translated from Russian. Show original

In this part:

Why so many entries#

Recipients' mail servers (Gmail, Outlook.com, Mail.ru, corporate filters) decide where to put your email — in "Inbox," "Spam," or reject it. The decision is based on your domain's DNS records. Without them, even honest emails end up in spam, and scammers can send emails "on your behalf."

Major mail carriers tightened their rules: since February 2024, Gmail requires all senders to have at least SPF or DKIM, while Gmail, Yahoo, and (since May 2025) Outlook.com from bulk senders (at least 5,000 emails per day) require SPF, DKIM, and DMARC. Set up all three at once, even if you have 10 employees.

Below everywhere the domain company.kz — replace it with your own.

Cheat sheet by notes#

RecordingWhereWhy
MXcompany.kzwhere to deliver incoming mail
SPF (TXT)company.kzwhich servers are allowed to send from the
DKIM (TXT or CNAME)селектор._domainkey.company.kzpublic key for verifying the digital signature of a
DMARC (TXT)_dmarc.company.kzwhat to do with unverified emails and where to send reports
PTRthe IP owner (provider/hosting)reverse IP → server name (for their server)
MTA-STS (TXT + file over HTTPS)_mta-sts.company.kzrequire TLS encryption when delivering to you
TLS-RPT (TXT)_smtp._tls.company.kzTLS issue reports when delivering to you
Autodiscover / autoconfigCNAMEauto-configuring Outlook and mail clients

MX — where the mail arrives#

Take values from your service's domain connection wizard , not from articles: Microsoft's MX name is unique for each domain.

ServiceMX (default value)
Microsoft 365company-kz.mail.protection.outlook.com (exact in the admin center)
Google Workspacesmtp.google.com, priority 1
Yandex 360mx.yandex.net, priority 10
Own servermail.company.kz (this name must have an A-record)

Rule: MX points to a name, not an IP, and that name should not be CNAME.

SPF — who has the right to send#

One TXT record on the domain root. Only one or two records v=spf1 break the validation.

company.kz.  TXT  "v=spf1 include:spf.protection.outlook.com -all"

Typical include:

SenderWhat to add
Microsoft 365include:spf.protection.outlook.com
Google Workspaceinclude:_spf.google.com
Yandex 360include:_spf.yandex.net
Your own serverip4:203.0.113.25 or mx
Mailings, CRM, website,include from the service documentation

Nuances:

  • -all — "everyone else is a fake";~all — "suspicious." Start with ~all, check all email sources (website, 1C, scanners, CRM), then move on to -all.
  • Limit — 10 DNS queries when checking SPF (each include, a, mx counts). Exceeded — SPF "breaks" (permerror). Remove unnecessary services or transfer them to submission through the main server.
  • SPF subdomains do not inherit. If the site sends from noreply@shop.company.kz — a custom record is needed for shop.company.kz.

DKIM — digital signature#

The sender's server signs each email with a private key, and the recipient verifies the signature with the public key from DNS. The signature confirms that the email has not been altered and has been sent by an authorized server.

  • Microsoft 365: Microsoft Defender portal → Email & collaboration → Policies → Threat policies → Email authentication settings → DKIM. The portal will show two CNAME records (selector1._domainkey and selector2._domainkey) — enter them into the DNS and enable the signature.
  • Google Workspace: Admin console → Apps → Google Workspace → Gmail → Authenticate email → generate a 2048-bit key → TXT google._domainkey → Start authentication.
  • Yandex 360: domain settings — ready TXT record (selector mail).
  • Own server (Mailcow): ARC/DKIM keys section in panel settings — generate a 2048-bit key, enter TXT dkim._domainkey.
dkim._domainkey.company.kz.  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqh...длинный ключ..."

Long key: Some DNS panels require splitting into 255-character strings — this is normal, the recipient will merge them.

DMARC — Policy and Reporting#

DMARC links SPF and DKIM to the From address seen by the person (this is called alignment) and tells the recipient what to do if there is a mismatch.

_dmarc.company.kz.  TXT  "v=DMARC1; p=none; rua=mailto:dmarc@company.kz; fo=1"
ParameterValue
p=noneonly collect reports, don't block anything
p=quarantinenot vetted — to spam
p=rejectfailing the verification — reject
rua=where to send daily summary reports (XML)
pct=to what share of emails to apply the policy (for a smooth transition)
sp=policy for

Implementation plan:

  1. Weeks 1–4: p=none, collecting reports, finding all legitimate sources of letters.
  2. We set SPF/DKIM for each found source (CRM, website, mailings).
  3. p=quarantine; pct=25 → pct=100.
  4. p=reject is the ultimate goal. This is the main protection against "director" emails from your domain.

XML reports are inconvenient to read with your eyes — analysis in part 5: Corporate mail, part 5: security — phishing, MFA, DMARC reports, archiving, and backup.

FCrDNS rule: PTR for 203.0.113.25 points to mail.company.kz, and A-record mail.company.kz to 203.0.113.25. And the same name is given by the server in the greeting SMTP (HELO/EHLO). Without PTR, many recipients will simply reject it.

MTA-STS and TLS-RPT — incoming mail encryption#

By default, SMTP encryption is "optional": an attacker in the middle can disable it. MTA-STS tells senders: "deliver to me only via TLS with a valid certificate."

  1. TXT record (change the id value each time the policy changes):
_mta-sts.company.kz.  TXT  "v=STSv1; id=20261110T000000"
_smtp._tls.company.kz. TXT "v=TLSRPTv1; rua=mailto:tlsrpt@company.kz"
  1. HTTPS policy file with a valid certificate at https://mta-sts.company.kz/.well-known/mta-sts.txt:
version: STSv1
mode: testing
mx: company-kz.mail.protection.outlook.com
max_age: 604800

Start with mode: testing (reports only), and after a couple of weeks without errors — mode: enforce. In the lines mx: list all your MX (mask *.company.kzallowed). If you changed mail services, first update the policy file, then MX.

Autodiscover and client auto-configuration#

  • Microsoft 365: CNAME autodiscover.company.kz → autodiscover.outlook.com.
  • Own server (Mailcow): CNAME autodiscover and autoconfig on mail.company.kz — Outlook and Thunderbird will be configured by address and password.

How to check#

From the command line (Linux/macOS — dig, Windows — nslookup or Resolve-DnsName):

dig +short MX company.kz
dig +short TXT company.kz
dig +short TXT _dmarc.company.kz
dig +short TXT selector1._domainkey.company.kz   # для M365 — CNAME, для остальных — свой селектор
dig +short -x 203.0.113.25                       # PTR своего сервера
Resolve-DnsName company.kz -Type MX
Resolve-DnsName _dmarc.company.kz -Type TXT

Online inspections:

  • mail-tester.com — send a letter to the issued address and receive a score out of 10 with a transcript;
  • MXToolbox — checks for MX, SPF, DMARC, blacklists;
  • Google Postmaster Tools — your domain reputation in Gmail (requires a noticeable volume of emails);
  • in the received email, open the headers (in Gmail — "Show original") and find the line Authentication-Results: must be spf=pass, dkim=pass, dmarc=pass.

Common mistakes#

ErrorConsequence
Two SPFSPF records don't work for anyone
More than 10 include SPFpermerror, spam emails,
Forgot website/1C/scanner in SPFtheir emails are rejected after -all and p=reject
DKIM is included in DNS but not in the serviceis not signed
Immediately p=rejectemails from the CRM and mailings that no one knew about disappeared
No PTR on your serverdeviations from large mail carriers
TTL MX 24 hours when movingemails go to the old server

Domain checklist#

  • Domain extended with auto-renewal, registrar access is with the company, not the contractor
  • MX according to the service wizard
  • One SPF record, no more than 10 lookups, final -all
  • DKIM 2048 bit enabled for each sender
  • DMARC: none → quarantine → reject, reports are being analyzed
  • PTR for your server
  • MTA-STS and TLS-RPT
  • mail-tester rating 9–10 out of 10

Next — launch Microsoft 365: Corporate Mail, part 3: Microsoft 365 — tenant, domain, licenses, synchronization with AD via Entra and MFA.

Comments 00 участников · 0 гостей🔒 Rate and discuss after signing up

Comments · 0

No comments yet.Sign in to comment, rate and see all comments.