Cheat sheet

SMTP, SPF, DKIM & DMARC — Cheat sheet

Reference for tracing mail delivery and diagnosing SMTP transport, SPF, DKIM, DMARC, alignment and reputation.

⌚ About 3 min read
View my favorites
EmailIntermediate to advanced8 sections · 32 reference points

Reference for tracing mail delivery and diagnosing SMTP transport, SPF, DKIM, DMARC, alignment and reputation.

SMTP ports & roles

25/TCP
SMTP serveur à serveur

Standard MTA-to-MTA port; often blocked outbound on consumer links.

587/TCP
Message Submission

Recommended submission port for authenticated clients/apps with STARTTLS

465/TCP
Submission TLS implicite

Commonly offered for implicit TLS submission.

993/TCP
IMAP sur TLS

Mailbox access, separate from SMTP sending.

SMTP codes to know

2xx
Succès

250 generally means the SMTP step was accepted.

4xx
Échec temporaire

The sending MTA should normally retry later.

550 / 5.1.1
Destinataire rejeté/inexistant

Check recipient address, domain and routing.

5.7.x
Politique / authentification / security

Often related to relay, anti-spam, SPF/DKIM/DMARC or permissions.

SPF

Location
TXT à la racine du domaine

SPF is a TXT record; multiple separate SPF records make evaluation invalid.

Example
v=spf1 include:spf.protection.outlook.com -all

Authorizes declared infrastructure and fails other sources.

DNS lookup limit
10 mécanismes/modificateurs générant des recherches DNS

include, a, mx, exists and redirect can consume the limit.

Check
Resolve-DnsName exemple.fr -Type TXT

Confirm that a single v=spf1 record is published.

DKIM

Selector
selector._domainkey.exemple.fr

Allows multiple keys and rotation without changing the From domain.

Public key
v=DKIM1; k=rsa; p=...

DNS contains the public key; private key stays with the sender.

Resolve selector
Resolve-DnsName selector1._domainkey.exemple.fr -Type TXT

Use the selector shown in the DKIM-Signature header.

Key rotation
Publier nouvelle clé → basculer signature → retirer ancienne clé

Keep overlap long enough for messages still in transit.

DMARC & alignment

Location
_dmarc.exemple.fr TXT

DMARC policy is published under _dmarc.

Policies
p=none | quarantine | reject

Often start with none for visibility before enforcement.

SPF alignment
MAIL FROM / Return-Path aligné avec From

SPF pass alone is not enough if the domain is not aligned.

DKIM alignment
d= de DKIM aligné avec From

DMARC passes when at least one aligned mechanism passes.

DNS & connectivity tests

MX
Resolve-DnsName exemple.fr -Type MX

Checks published receiving servers.

DMARC
Resolve-DnsName _dmarc.exemple.fr -Type TXT

Checks policy and reporting addresses.

SMTP 587
Test-NetConnection smtp.exemple.fr -Port 587

Validates TCP only, not authentication or message submission.

SMTP TLS
openssl s_client -starttls smtp -connect smtp.exemple.fr:587 -servername smtp.exemple.fr

Inspects certificate and STARTTLS negotiation where OpenSSL is available.

Headers to inspect

Received
Chaîne des relais SMTP

Read bottom-up to reconstruct the delivery path.

Authentication-Results
Results SPF/DKIM/DMARC du récepteur

Often the most useful evidence of authentication failure.

Return-Path
Adresse d’enveloppe après livraison

Used for SPF evaluation and bounces.

Message-ID
Identifiant du message

Keep it for correlation in message traces.

Troubleshooting order

1. Transport
MX + port + code SMTP

Confirm delivery reaches the right service before domain authentication.

2. Source
IP / Return-Path / HELO

Identify the actual sending source, especially apps and relays.

3. Authentication
SPF + DKIM + DMARC

Check pass/fail and alignment with From.

4. Reputation/policy
Antispam, blocklist, tenant policy

Authenticated mail can still be blocked by content or reputation.

Key points

  • Publish only one v=spf1 SPF record per domain.
  • Do not move to p=reject until all legitimate senders are identified.
  • Never share a DKIM private key in tickets or web tools.
  • Keep full headers from rejected messages; they are often more valuable than screenshots.
← All cheat sheets
♡ 0