Which SMTP port should I test: 25, 587 or 465?

Port 25 is where mail servers hand messages to each other, so it's the port to test when you want to know whether a domain can receive mail. Ports 587 and 465 are for mail programs, phones, printers and apps that log in to send, so test one of those on the server your mail program uses. A server that only receives mail often leaves 587 and 465 closed, and that silence is not a fault.

Last reviewed: 5 December 2026.

What ports 25, 587 and 465 are for

Port 25 carries mail from one server to the next, port 587 takes new mail from people's programs after they log in, and port 465 does the same job over a connection that is encrypted from the first byte.

Read moreShow less: What ports 25, 587 and 465 are for

Port 25, relay. RFC 5321, the SMTP standard, asks a receiving server to keep listening on the SMTP port, which it names as port 25. When someone at another company writes to you, their provider's server looks up your MX records and connects to port 25 on the host listed there. RFC 6409 notes that relay is not often authenticated, so that any server can reach any other, and RFC 5068 adds that Internet mail can be exchanged without prior arrangement.

Port 587, submission. RFC 6409, the 2011 edition of a standard first published in 1998 as RFC 2476, splits the first step, a person's mail program handing over a new message, from the relay between servers. Relay stays on port 25, and submission normally uses port 587. The submission server must know who is sending: by default it has to refuse a message from a session that hasn't logged in with SMTP AUTH, unless it already trusts the sender some other way, such as a protected internal network. The connection starts in plain text and normally switches to encryption with the STARTTLS command.

Port 465, submission over implicit TLS. RFC 8314 made port 465 a standard submission port where the TLS handshake starts the moment the connection opens, before any SMTP is spoken. The submission rules of RFC 6409, including the login, apply here too.

Port  Job                     Who connects                 Encryption
25    relay between servers   other mail servers           STARTTLS when offered
587   submission, with login  mail programs, phones, apps  STARTTLS
465   submission, with login  mail programs, phones, apps  TLS from the first byte

If you have read that 465 is obsolete, that is the old story. RFC 8314 explains that 465 was briefly registered as "smtps", which made no sense for relay because MX records can't name a port, so the registration was revoked. Mail software kept using 465 for encrypted submission anyway, and in 2017 IANA registered it as "submissions", Message Submission over TLS protocol, as a one-time exception.

How STARTTLS and implicit TLS differ on the wire

STARTTLS opens in plain text and upgrades the same connection, implicit TLS encrypts from the start, and in both cases a server can show more features after encryption than before.

Read moreShow less: How STARTTLS and implicit TLS differ on the wire

STARTTLS is defined in RFC 3207. The client reads the 220 greeting, sends EHLO, and if the answer lists STARTTLS, asks to switch. After the handshake both sides must forget what they learnt in plain text, the client should send EHLO again, and the server's feature list may now be different.

That difference matters for logging in. RFC 4954, the SMTP AUTH standard, says a server must be able to refuse plain-text password methods until STARTTLS or similar protection is in place. Our worked examples show it: smtp.gmail.com on port 587 listed no AUTH line before STARTTLS, while on 465, where the list came after encryption, it offered several login methods.

RFC 8314 says clients and servers should support both 587 with STARTTLS and 465 during a transition period of several years, and that there is no significant difference in protection when both sides are set up correctly and refuse to continue without TLS. Its general advice prefers implicit TLS.

Port 25 is softer. RFC 3207 says a publicly referenced server, meaning port 25 on a host named in a domain's MX records, must not insist on STARTTLS before accepting mail for its own users. There, STARTTLS may be offered but must not be demanded.

On 587 and 465, RFC 8314 says the mail program must check the server's certificate. Between mail servers on port 25, TLS can be opportunistic: the sender encrypts without proving who is at the other end, unless the receiving domain publishes an MTA-STS policy (RFC 8461) or DANE records (RFC 7672). Our guide to mail-server certificates covers what makes one valid.

Testing receiving and testing sending are two different tests

To check that a domain can receive mail, test port 25 on its MX servers; to check the server your mail program sends through, test 587 or 465 on that submission host.

Read moreShow less: Testing receiving and testing sending are two different tests

Can this domain receive mail? Open the SMTP test, type the domain, leave "It's a domain: look up its mail server (MX) first" ticked and choose port 25. Our test looks up the MX records, picks the lowest preference number, which senders try first, and connects to it. A domain with no MX records gets its own address tested, the same fallback senders use. The MX lookup lists them all.

Can my mail program send through this server? Untick the MX box, type the outgoing server name exactly as your mail program has it, and choose 587 or 465. That host can be one that isn't among your MX hosts. Google's Workspace admin help is a clear example: for devices and apps it gives smtp.gmail.com, with 465 for SSL and 587 for TLS and a login required. It separately describes a restricted server, aspmx.l.google.com on port 25, which needs no login but delivers only to Gmail and Google Workspace users.

A pass shows the server is up and its TLS works, as seen from our server. It can't show whether your password works, because our test never logs in.

Refused, no answer, or couldn't connect

A refused connection means a reset came back instead of a connection, no answer means nothing came back within 10 seconds, and couldn't connect covers every other network error.

Read moreShow less: Refused, no answer, or couldn't connect

When the connection itself fails, the result shows one of three findings; below, {ip} and {port} stand for the address and port tested.

"{ip} port {port} refused the connection". Our explanation: "The machine answered but nothing accepts connections on this port." Under TCP's rules (RFC 9293), a connection request that matches nothing listening is answered with a reset, which is what our server reads as a refusal. It can mean the mail service isn't running, or was never set up on that port. A firewall set to reject rather than drop can send the same reset. The suggested fix: "Start the mail service on port {port}, or use the port your provider documents."

"No answer from {ip} port {port}". Our wording: "The connection timed out after 10 seconds. The server is down, a firewall drops the connection, or nothing listens on this port." Ten seconds is our limit for the connection step. Silence tells you less than a refusal: a firewall that quietly discards requests and a switched-off machine can look the same.

"Couldn't connect to {ip} port {port}". Any other error while connecting. The result shows, in brackets, the error code our server's network software reported. It can point at the network path to that address rather than at the mail service.

After a refusal or a timeout, the result adds: "We test from one server. If this mail server's firewall blocks that one address, the result looks the same." On 587 and 465 it also says a server that only receives mail often has the port closed.

Once connected, the server gets up to 15 seconds to send its 220 greeting, and the whole test stops at 30 seconds. Those limits have findings of their own.

A receiving-only server is often closed on 587 and 465

Nothing in the standards asks an MX server to accept submissions, so a timeout or refusal on 587 or 465 at a receiving host can be exactly how it was set up.

Read moreShow less: A receiving-only server is often closed on 587 and 465

RFC 6409 treats submission as a separate service from relay, under its own rules. A provider can run the two under different names. On 5 December 2026 our SMTP test, run once per port from our one server, found Gmail's MX host answering on port 25 and giving no answer on 587, while smtp.gmail.com answered on both 587 and 465.

So "No answer" on 587 at an MX host is only a problem if you expected that machine to take submissions. The reverse is not true. MX hosts need port 25 open to the internet, because, as RFC 8314 puts it, MX records have no way to name a port, so port 25 is always used. Under RFC 5321 a sender that can't connect must queue the message and retry, generally at least 30 minutes apart, with a give-up time of generally at least 4 to 5 days. A port 25 that stays shut on every MX host means delays first and bounced emails later.

Networks that block outbound port 25

Google Cloud, Azure and Amazon EC2 document blocking outgoing connections to port 25 by default on many accounts, and Google Cloud and Azure say 587 stays open, so a timeout seen from those networks may not be the server's fault.

Read moreShow less: Networks that block outbound port 25

RFC 6409 notes that many sites prohibit outbound traffic on port 25 because of malware that sends spam, and RFC 5068 adds that access providers must not block the submission port 587. Three cloud providers document their own rules:

  • Google Cloud blocks connections to destination TCP port 25 outside your VPC network, due to the risk of abuse, though some projects don't have the restriction. It doesn't restrict destination ports 587 and 465.
  • Microsoft Azure blocks outbound TCP port 25 for virtual machines on every subscription type except standard Enterprise Agreement and MCA-E, which aren't blocked. On Enterprise Dev/Test subscriptions the block is on by default and can be removed. Authenticated relay on 587 isn't restricted.
  • Amazon EC2 by default allows outbound port 25 only to private IPv4 addresses, blocks it to public IPv4 and IPv6 addresses, and lets you request removal.

A mail server on such a platform may receive on port 25 yet be unable to deliver directly, which is why Google Cloud and Azure point you to a relay service, while Amazon lets you ask for the restriction to be removed. And a port 25 test run from a blocked network can time out whatever the far server does; our SMTP test runs from its own server, not yours.

What our SMTP test does and doesn't check

Our test connects over IPv4 from one server, reads the greeting, sends EHLO, starts TLS where it can and says QUIT, so it never sends mail, never logs in, and can't see inside the server.

Read moreShow less: What our SMTP test does and doesn't check

What it does. Our test server, probe.dnsmailcheck.com, connects on the port you choose, waits for the greeting, sends EHLO probe.dnsmailcheck.com and records the feature list. On 25 and 587 it sends STARTTLS if offered; on 465 it starts TLS at once. It records the TLS version, cipher and certificate, checks that the chain verifies and the name matches, then sends QUIT. EHLO, STARTTLS and QUIT are the only commands the service can send, so no message ever reaches the server.

What it doesn't do.

  • IPv6. It connects to the host's first IPv4 address only and lists any IPv6 address as "IPv6 not tested".
  • Every address. One address is tested, even when a host has several or a domain has several MX hosts. RFC 5321 tells senders to try the alternatives in order.
  • Other source addresses. Every test comes from 40.160.102.17. A server that blocks that address can look broken to us while it works for other senders.
  • Logging in. It never sends AUTH.
  • Features after STARTTLS. It sends EHLO once, before STARTTLS, so on 25 and 587 you see the features offered before encryption.
  • The inside of the server. It can't see queues, filters, logs or relay rules, so what a result says about a server's setup is what it can mean, not proof.

After a change, use the "Re-check after you change the server" button under the result's summary to run the test again.

Worked examples: gmail.com and smtp.gmail.com, checked 5 December 2026

Gmail's MX host answered on port 25 with TLS 1.3 and gave no answer on 587, while smtp.gmail.com answered on 587 with STARTTLS and on 465 with TLS from the start.

Read moreShow less: Worked examples: gmail.com and smtp.gmail.com, checked 5 December 2026

Four runs of our production SMTP test, between 12:50:08 and 12:50:21 UTC.

gmail.com, MX ticked, port 25. gmail.com has five MX records, preferences 5 to 40. The test chose gmail-smtp-in.l.google.com, connected to 142.251.111.27 in 16 ms and got 220 mx.google.com ESMTP … gsmtp. The EHLO answer began mx.google.com at your service, [40.160.102.17], our own address read back, and listed STARTTLS. The upgrade gave TLS 1.3, with a Google Trust Services certificate for mx.google.com whose 26 names include gmail-smtp-in.l.google.com. Summary: "gmail-smtp-in.l.google.com answered on port 25 in 183 ms, TLSv1.3 via STARTTLS."

gmail.com, MX ticked, port 587. Same host and address, next run: "No answer from 142.251.111.27 port 587", after the 10-second limit, and the summary "gmail-smtp-in.l.google.com didn't complete the test on port 587." In that run, from our one address, that host took no connection on the submission port.

smtp.gmail.com, port 587. 142.251.111.109 connected in 16 ms and greeted as smtp.gmail.com ESMTP. The feature list included STARTTLS but no AUTH line. After the upgrade to TLS 1.3, the certificate for smtp.gmail.com matched and verified. Summary: "smtp.gmail.com answered on port 587 in 136 ms, TLSv1.3 via STARTTLS."

smtp.gmail.com, port 465. Same address, TLS 1.3 negotiated before the greeting. The finding read "Encrypted from the first byte (implicit TLS on port 465)." With EHLO after encryption, the list included AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH. Summary: "smtp.gmail.com answered on port 465 in 141 ms, TLSv1.3 from the start."

SMTP test, 5 December 2026 (UTC)
12:50:08  gmail.com (MX gmail-smtp-in.l.google.com)  port 25   pass  TLSv1.3 via STARTTLS    183 ms
12:50:19  gmail.com (MX gmail-smtp-in.l.google.com)  port 587  fail  No answer (timed out)   10004 ms
12:50:20  smtp.gmail.com                             port 587  pass  TLSv1.3 via STARTTLS    136 ms
12:50:21  smtp.gmail.com                             port 465  pass  TLSv1.3 from the start  141 ms

When a port doesn't answer

Confirm the host, then check the address it resolves to, then the service and the firewall.

Read moreShow less: When a port doesn't answer
  1. Host. For receiving, confirm with the MX lookup that you tested the lowest-numbered MX. For sending, copy the server name from your provider's setup page.
  2. Address. The DNS lookup shows the A record the name resolves to now. An old address can explain a failure at once.
  3. Your own server. Check that the mail service is running and that its firewall, and any cloud firewall in front of it, allows the port. For port 25 on an MX host, that means from anywhere.

If mail arrives but lands in junk, the ports are fine: see emails going to spam, and check your sending address with the reverse DNS lookup and our reverse DNS guide.

SMTP port questions

Short answers on choosing a submission port, sending on port 25, testing from your own network, timeouts and what a pass proves.

Should I use port 587 or 465 in my mail program?

Use whichever your provider documents. RFC 8314 asks for both to be supported and prefers implicit TLS, which is 465. Google lists both for smtp.gmail.com.

Can I send my own mail out on port 25?

Mail programs should submit on 587 or 465 with a login. A server delivering directly to other domains needs outbound port 25, and Google Cloud, Azure and Amazon EC2 all document blocking it by default on many accounts.

Why does port 25 work from your test but not from my office?

Your network may block outgoing port 25, as RFC 6409 says many sites do. Our test runs from its own server, so it shows what a server elsewhere on the internet sees from our one address, not what your network allows.

Does a timeout prove the port is closed?

No. It shows only that nothing came back to our one address within 10 seconds. The server could be down or a firewall could be dropping our connection. If it's your server, check its firewall logs for 40.160.102.17.

Does a successful test mean mail will be delivered?

No. It means the server answered, greeted and set up TLS for us. Whether a message is accepted also depends on later checks such as SPF, DKIM and DMARC and on the server's own filters, which this test never reaches.

Related guides, tools and problems

These pages cover the test, the records behind a mail server and the problems a closed port tends to cause.