Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Self-hosting

Why self-hosted email lands in spam, and how to fix it

Self-hosted mail going to spam or bouncing? Fix PTR and HELO, SPF, DKIM and DMARC alignment, TLS and reputation, then meet the Gmail and Outlook sender rules.

CloudSat teamNovember 18, 20267 min read
Abstract illustration of envelopes gliding along a glowing track through a row of checkpoint gates
On this pageRead what the receiver told you

Large mailbox providers judge incoming mail in a fairly fixed order. First the connecting address and its name, then whether the domain authenticates the message, then the connection's security, and only after that the sender's reputation and the content. A perfectly written message from an address without reverse DNS still bounces. So fix deliverability in the same order, and start with what the receiving server already told you.

Read what the receiver told you

A rejected message comes back with an enhanced status code and a sentence of explanation. Google documents its codes, and the common ones point straight at the fix:

Gmail code What it means Fix in
550 5.7.25, or 451 4.7.23 (temporary) The sending IP has no PTR record, or the PTR name does not resolve back to that IP Step 1
550 5.7.26, or 421 4.7.26 (rate limited) The message is unauthenticated: neither SPF nor DKIM passed, or DMARC policy failed Step 2
421 4.7.0 A temporary block; the text says why: missing PTR, TLS required, or very low reputation The step the text names
421 4.7.28, or 550 5.7.28 An unusual rate of mail from your IP or domain Step 4
550 5.7.1 Policy or likely unsolicited mail; also IPv6 mail without PTR and authentication Steps 1, 4 and 6
5.7.27, 5.7.30, 5.7.32, 5.7.40 Bulk sender failures: SPF, DKIM, From alignment, missing DMARC record Step 5

Outlook.com uses 550 5.7.515 for high-volume senders whose domain fails its authentication requirements. When mail is delivered but filed as spam, open the message source at the receiver and read the Authentication-Results header. You want spf=pass, dkim=pass and dmarc=pass before you look at anything else.

Step 1: the address and its name

Gmail requires every sender to have valid forward and reverse DNS: the IP's PTR record names a host, and that host name resolves back to the same IP. The name your server announces in its EHLO greeting should be that same name.

dig -x 203.0.113.25 +short       # expect: mail.example.com.
dig +short A mail.example.com     # expect: 203.0.113.25
postconf myhostname               # Postfix: expect mail.example.com

On CloudSat, the PTR record is set from the console, as described in Set reverse DNS for your IPv4, and Send email from your server shows how to check that outbound port 25 is open. If the server also has an IPv6 address, Gmail checks it just as strictly; give it matching reverse DNS or have the mail server send over IPv4 only.

Step 2: SPF, DKIM and DMARC that align

Passing SPF or DKIM is not enough on its own. DMARC asks whether the domain in the visible From: address matches the domain that SPF checked (the envelope sender) or the d= domain of a valid DKIM signature. Mail sent as news@example.com through a service that signs with its own domain passes DKIM and still fails DMARC.

Check what the world sees:

dig +short TXT example.com | grep spf1
dig +short TXT s1._domainkey.example.com
dig +short TXT _dmarc.example.com

The mistakes that cause most failures:

  • Two SPF records on one name. SPF allows one; merge them into a single v=spf1 record.
  • More than ten DNS lookups in SPF, usually from stacked include: entries. The check then fails with a permanent error.
  • A DKIM selector mismatch: the server signs with a selector whose public key is not published, or the key was cut when pasted into DNS.
  • An application on the same server sending through a local mail transport that does not sign at all.

Roll DMARC out in stages. Publish p=none with a rua address, read the aggregate reports for a few weeks until every legitimate source passes, then move to quarantine and finally reject.

Step 3: TLS in transit

Gmail requires a TLS connection for all senders. Confirm that your server offers STARTTLS with a valid certificate, on port 25 for server-to-server mail:

openssl s_client -starttls smtp -connect mail.example.com:25 -servername mail.example.com -brief < /dev/null

Two DNS-based standards go further. MTA-STS (RFC 8461) tells other servers to deliver to your domain only over TLS with a trusted certificate, and TLS-RPT (RFC 8460) asks them to send you reports when TLS fails:

_mta-sts.example.com.    IN TXT "v=STSv1; id=20261118;"
_smtp._tls.example.com.  IN TXT "v=TLSRPTv1; rua=mailto:tls-reports@example.com"

The policy itself is a text file served at https://mta-sts.example.com/.well-known/mta-sts.txt:

version: STSv1
mode: testing
mx: mail.example.com
max_age: 604800

Start in testing mode, read the TLS reports, then switch to enforce and change the id in DNS so senders fetch the new policy.

Step 4: reputation, built over time

A new IP address or domain has no history, and receivers are cautious with strangers. Begin with mail people expect and answer, at low volume, and raise volume gradually over weeks. Before the first message, look up the IP on Spamhaus's reputation checker: a recycled address may carry someone else's listing.

Then watch what the big providers see:

  • Google Postmaster Tools (version 2 is current) shows your domain's spam rate. Google asks senders to stay below 0.10% and never reach 0.30%.
  • Microsoft SNDS, now on a new portal, shows data about your IP addresses for Outlook.com traffic.

Keep streams apart. Newsletters from a subdomain such as news.example.com, or through a separate relay, mean that complaints about a campaign never drag down the mailbox you use to talk to customers.

Step 5: the rules for bulk senders

If you send more than 5,000 messages a day to Gmail, extra requirements apply, and Yahoo sets similar ones:

Requirement Gmail Yahoo
Authentication SPF and DKIM SPF and DKIM
DMARC Published, p=none is enough, From: aligned with SPF or DKIM At least p=none, and DMARC must pass
Unsubscribe One-click for marketing and subscribed mail, plus a visible link One-click header, plus a visible link
Honoring unsubscribes Within 48 hours, per Google's FAQ Within 2 days
Spam rate Below 0.3% Below 0.3%

Google has been ramping up enforcement since November 2025, with temporary and permanent rejections for mail that misses the requirements. Outlook.com has enforced SPF, DKIM and DMARC for senders of more than 5,000 messages a day since May 5, 2025: both SPF and DKIM must pass, DMARC must pass with at least one of them aligned, and non-compliant mail can be junked or refused with 550 5.7.515.

One-click unsubscribe means two headers, defined in RFC 8058:

List-Unsubscribe: <https://example.com/unsubscribe/opaque-token>
List-Unsubscribe-Post: List-Unsubscribe=One-Click

The DKIM signature must cover both headers. The URL must accept a plain POST without cookies or a login, and must not redirect.

Step 6: content and list hygiene

Once identity and reputation are sound, the remaining problems are usually the list:

  • Send only to people who asked for the mail, and remove addresses that hard-bounce after the first failure.
  • Suppress anyone who complains or unsubscribes, in every tool that sends mail for you.
  • Keep the From: name and address consistent, include a plain-text part, and avoid link shorteners and image-only messages.

FAQ

Should I relay through an email service instead?

For newsletters and high-volume transactional mail, it is often the pragmatic choice: a relay brings an established sending reputation and processes bounces and complaints for you. Your own server then hands mail to the relay on port 587, which avoids port 25 entirely.

How long does a new server need to build a reputation?

There is no fixed period. It depends on volume and on how recipients react. Increase volume step by step and let the spam rate in Postmaster Tools guide the pace.

Will p=reject improve inbox placement?

Not directly. It stops others from sending mail that claims to be from your domain, which protects your reputation over time. Move to it once the reports show every legitimate source passing.

Why does Outlook junk mail that Gmail accepts?

Each provider runs its own filters and keeps its own view of your IP and domain. Check SNDS for the address, confirm that DMARC passes with alignment, and compare the Authentication-Results headers from both providers.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.