Gmail and Yahoo decide whether to accept mail from your own server by checking things that live outside it: the IP address, its reverse DNS and the IP’s reputation [1][3]. Your network’s policy on port 25 decides whether the mail leaves at all.

The short answer

You need a static IP address whose PTR record names a host that resolves back to it, outbound port 25, TLS, SPF, DKIM and DMARC, an IP that stays off blocklists, and someone who applies security updates [1][3][5]. AWS and Google Cloud block outbound port 25 by default, and so does Azure outside its Enterprise Agreement and MCA-E subscriptions [8][9][10].

What it looks like

A server without a valid reverse DNS record gets this from Gmail [2]:

550 5.7.25 This message was blocked because the sending IP address doesn't have a PTR record, or the forwarding DNS entry doesn't reference the sending IP address. Gmail requires that sending IP addresses have a PTR record. …
Exact text from source [2]

And a server that does not use TLS, once Gmail treats it as a bulk sender [2]:

550 5.7.29 This message was blocked because it wasn't sent over a TLS connection. Gmail requires all bulk email senders to use TLS/SSL for SMTP connections. …
Exact text from source [2]

Yahoo lists a Spamhaus listing of your IP among the reasons for its permanent 553 and 554 rejections [4].

What receivers check before they accept your mail

Requirement Who asks for it Source
Valid forward and reverse DNS (PTR) for the sending IP Gmail and Yahoo, for every sender. Gmail also requires the PTR host name to resolve back to the same IP [1][3]
TLS on the connection Gmail, for every sender [1]
SPF or DKIM; SPF, DKIM and DMARC for bulk senders Gmail and Yahoo [1][3]
An IP address that is not on a blocklist Yahoo names a Spamhaus listing as a cause of permanent rejections [4]
No open relay Yahoo does not accept mail from open proxies and open relays [4]
Current security patches Yahoo recommends them for every mail server [3]

The full list for each mailbox provider is in Gmail, Yahoo and Outlook sender requirements.

The IP address and its reverse DNS

Gmail checks both directions. The sending IP needs a PTR record that resolves to a host name, and that host name needs an A or AAAA record that resolves back to the same IP [1]. Yahoo adds that the PTR should be “non-generic” and should not look like “a dynamically-assigned IP” [3].

For a server at 203.0.113.25, the pair looks like this. The PTR record sits under in-addr.arpa, with the address written in reverse [12]:

mail.example.com.            A    203.0.113.25
25.113.0.203.in-addr.arpa.   PTR  mail.example.com.

You publish the A record in your own zone. The PTR record lives in a zone run by whoever controls the IP address, such as your ISP or hosting company. Spamhaus sends you to your ISP to set up a static IP with forward and reverse DNS [5].

Outbound port 25 on cloud servers and home lines

Servers deliver mail to each other on port 25, because an MX record has no way to name another port [15]. The large clouds close it by default, and so do many home ISPs:

  • AWS: EC2 allows outbound port 25 only to private IPv4 addresses and blocks it to public IPv4 and IPv6 addresses. You can ask AWS to remove the restriction [8].
  • Google Cloud: connections to port 25 are blocked when the destination is outside your VPC network. Google notes that some projects do not have this restriction [9].
  • Azure: VMs on Enterprise Agreement and MCA-E subscriptions can use port 25. Enterprise Dev/Test subscriptions are blocked by default with an exemption you can request, and all other subscription types are blocked [10].
  • Home connections: Spamhaus says many ISPs no longer allow port 25 for their residential customers [5].

Blocklists, as Spamhaus documents them

Spamhaus runs several IP blocklists, and Yahoo names Spamhaus in its rejection notes [4]. Each list has its own rules:

  • Policy Blocklist (PBL). End-user IP ranges that should not deliver unauthenticated mail straight to other mail servers. It can list static IPs as well as dynamic ones [5]. You can remove a single IP only if it is static, runs an outbound mail server, has forward and reverse DNS, and is assigned to you. Such an exclusion expires after one year and is reversed if Spamhaus detects spam from the IP [5].
  • Exploits Blocklist (XBL). Individual IPs that show signs of compromise. Spamhaus warns that “systems that are deployed and forgotten will get compromised” [6].
  • Spamhaus Blocklist (SBL). IPs that appear to be used by spammers. Only the network or hosting company responsible for the IP can handle an SBL removal [7].

Removals for the PBL and the XBL go through Spamhaus’s IP and Domain Reputation Checker [5][6]. Other blocklists publish their own listing and removal rules.

TLS

Gmail requires every sender to use TLS [1]. Between mail servers, TLS is started with the STARTTLS extension of SMTP [11]. Turn on STARTTLS for outgoing connections, and give the server a certificate so it can offer TLS to servers that deliver to it.

The DNS records your domain publishes

A single server at 203.0.113.25 that sends and receives for example.com:

example.com.                  MX   10 mail.example.com.
example.com.                  TXT  "v=spf1 ip4:203.0.113.25 ~all"
mail._domainkey.example.com.  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
_dmarc.example.com.           TXT  "v=DMARC1; p=none; rua=mailto:dmarc@example.com"
  • MX: points at the host name from the A record above.
  • SPF: an ip4: term costs no DNS lookup, so it does not count toward the limit of 10 [13]. The SPF lookup guide explains that limit.
  • DKIM: the selector mail is an example. Your server generates the DKIM key pair and you publish the public half in a TXT record. Gmail requires keys of 1024 bits or longer and recommends 2048 [1].
  • DMARC: p=none expresses no preference to receivers [14] and starts reports to the rua address. Move the DMARC policy up as described in from p=none to p=reject.

Your own server, a hosted provider, or both

What it takes Your own server Hosted mailbox provider Receive yourself, send through a relay
Sending IP and its PTR Yours to get and keep clean The provider’s The relay’s
Outbound port 25 Must be open Not needed Not needed for sending
Blocklist monitoring You The provider The relay, for outgoing mail
Security updates You The provider You, for the receiving server
DNS you publish MX, SPF, DKIM, DMARC, and the PTR through your IP’s owner The provider’s MX, SPF include and DKIM, plus your DMARC Your MX, the relay’s SPF include and DKIM, plus your DMARC

The mixed option is what Spamhaus suggests for a dynamic IP: send through a relay, also called a smarthost [5]. Azure recommends an authenticated SMTP relay too, reached on port 587, which it does not block [10]. Spamhaus encourages mail submission on ports 465 and 587 with encryption and authentication [5].

If you move from your own server to a provider, or back, follow change email provider without losing a single message. Email provider DNS records lists the records each hosted provider asks for.

Mistakes to avoid

  • Running the server on a residential or dynamic IP. The PBL lists end-user ranges, and Spamhaus allows removal only for static IPs that run a mail server [5].
  • Keeping the generic PTR your ISP assigned. Yahoo recommends a non-generic PTR that reflects your domain [3].
  • Leaving the server as an open relay. Yahoo does not accept mail from open relays [4].
  • Installing it and forgetting it. Yahoo recommends current security patches [3], and the XBL lists IPs of compromised machines [6].
  • Ignoring bounces that mention a blocklist. Look the IP up with the list named in the bounce and follow that list’s removal rules [5][6][7].
  • Choosing a cloud VM before checking its port 25 policy. AWS and Google Cloud block it by default, and Azure blocks it on every subscription type except Enterprise Agreement and MCA-E [8][9][10]. AWS and Azure Dev/Test lift the block on request [8][10].

Check your domain’s email records

The checker reads your domain’s MX, SPF, DKIM and DMARC records from your browser. It cannot see your PTR record, your TLS setup or blocklist status, so check those with your IP’s owner and with each list.

Check your domain’s email records

Runs in your browser. Your domain is not sent to this site or stored.

Sources

  1. 1Email sender guidelinessupport.google.com, Google. Checked .
  2. 2Gmail SMTP errors and codesknowledge.workspace.google.com, Google. Checked .
  3. 3Sender Requirements & Recommendationssenders.yahooinc.com, Yahoo. Checked .
  4. 4SMTP Error Codessenders.yahooinc.com, Yahoo. Checked .
  5. 5Policy Blocklist (PBL)spamhaus.org, Spamhaus. Checked .
  6. 6Exploits Blocklist (XBL)spamhaus.org, Spamhaus. Checked .
  7. 7Spamhaus Blocklist (SBL)spamhaus.org, Spamhaus. Checked .
  8. 8Amazon EC2 service quotas (Restriction on email sent using port 25)docs.aws.amazon.com, Amazon Web Services. Checked .
  9. 9Sending email from an instancedocs.cloud.google.com, Google. Checked .
  10. 10Troubleshoot outbound SMTP connectivity problems in Azurelearn.microsoft.com, Microsoft. Checked .
  11. 11RFC 3207, SMTP Service Extension for Secure SMTP over Transport Layer Securityrfc-editor.org, IETF. Checked .
  12. 12RFC 1035, Domain Names: Implementation and Specification. Section 3.5 (IN-ADDR.ARPA)rfc-editor.org, IETF. Checked .
  13. 13RFC 7208, Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Version 1. Section 4.6.4rfc-editor.org, IETF. Checked .
  14. 14RFC 9989, Domain-Based Message Authentication, Reporting, and Conformance (DMARC). Section 4.7rfc-editor.org, IETF. Checked .
  15. 15RFC 8314, Cleartext Considered Obsolete: Use of Transport Layer Security (TLS) for Email Submission and Access. Section 7.3rfc-editor.org, IETF. Checked .