PortScan › Port guide › Port 25
Port 25 (SMTP): Mail Server Port and Open Relay Checks
Port 25 is SMTP for server-to-server mail. Misconfigured as an open relay, it becomes a spam source. Covers ISP port 25 blocking and how 587/465 differ.
What is port 25?
SMTP is the protocol for sending mail. Port 25 is used for relaying between mail servers (MTA-to-MTA transfer). When users send mail from a mail client, they normally use port 587 (STARTTLS) or 465 (TLS).
If you run your own mail server, port 25 is supposed to be open: other servers connect to it on port 25 to deliver mail to you.
When it is normally open
- You run your own mail server (Postfix, Exim, Exchange, etc.)
- Inbound mail gateways and spam-filtering appliances
Risks if it is open
Open relay
A server configured to let anyone send mail to external addresses without authentication. Once discovered it is immediately used to send spam, and the server's IP lands on spam blocklists (RBLs), so even legitimate mail stops being delivered.
Sending after credential guessing
Even with relaying blocked, a weak mail account that gets cracked can be used to authenticate and send spam. Check the authentication failure logs on port 587 as well.
Security checklist
- Allow relaying only for authenticated users and the internal network. Postfix:
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination. - Accept user submissions on port 587 (authentication required) and keep authentication off port 25.
- Set up SPF, DKIM and DMARC to stop your domain from being spoofed.
- If the machine is not a mail server but port 25 is open, turn that service off (for example a Postfix or sendmail installed by default) or set
inet_interfaces = loopback-only.
How to check whether port 25 is open
Cloudflare blocks connections to port 25, so this site's Precise (edge) scan cannot check it. Check it directly on the server with the commands below.
From outside (is it exposed to the internet?)
Whether your server or home router accepts port 25 from the internet can only be confirmed by connecting from outside. A check from inside the same network bypasses the router's firewall and gives a different answer.
PortScan opens a real TCP connection from the Cloudflare edge and reports Open, Closed or Filtered. Members can scan every port on their own IP for free and other targets free once a day.
Check port 25On the server (what is listening?)
Windows (PowerShell):
netstat -ano | findstr ":25 "
Get-NetTCPConnection -LocalPort 25 -State Listen | Select LocalAddress,OwningProcess
Linux:
sudo ss -tlnp | grep ':25 '
If it listens on 0.0.0.0 or [::] it is open on every network; 127.0.0.1 means only that machine can connect. To test port 25 on a server from another computer, use Test-NetConnection server-address -Port 25 on Windows or nc -vz server-address 25 on Linux and macOS.
How to close or restrict port 25
The best fix is to turn the service off or make it listen only on 127.0.0.1 (see the checklist above). If you need the service but must keep it off the internet, use a firewall.
Windows Firewall
# Administrator PowerShell
New-NetFirewallRule -DisplayName "Block TCP 25" -Direction Inbound -Protocol TCP -LocalPort 25 -Action Block
# To allow a single IP instead (block rules take precedence, so use this instead of the rule above)
New-NetFirewallRule -DisplayName "Allow TCP 25 from office" -Direction Inbound -Protocol TCP -LocalPort 25 -RemoteAddress 203.0.113.10 -Action Allow
Linux (ufw)
sudo ufw deny 25/tcp
# Allow a single IP only
sudo ufw allow from 203.0.113.10 to any port 25 proto tcp
On a cloud server, also check port 25 in the security group (inbound rules), which is separate from the OS firewall. For services running in Docker, the rules Docker creates can bypass ufw, so binding the port to localhost with -p 127.0.0.1:25:25 is the reliable option.
Router
At home or in a small office, open the router's admin page and check whether port 25 is in the port forwarding list, whether DMZ is enabled, and whether any program opened ports by itself through UPnP. If any of the three applies, port 25 on your PC is directly visible from the internet.
How to read the scan result
- Open — something accepted a connection on port 25. Work through the risks above.
- Closed — the packet reached the device, but nothing is listening on that port, so it was refused immediately (RST). The service is off.
- Filtered — no response. A firewall or the ISP is dropping packets, or the device is off. From an exposure point of view this is the safest state.
The verdict can depend on where you connect from. Many ISPs (including most Korean ISPs) block some ports such as 135, 139 and 445 on their network, so the same server can look Filtered from inside that network and Closed from abroad.
FAQ
- Why does PortScan show port 25 as "Undetermined"?
- The Precise (edge) scan connects from Cloudflare's edge, and Cloudflare blocks outbound connections to port 25 to prevent spam. You need another tool to check this port. On the server itself, use
ss -tlnp | grep :25. - Can I run a mail server on a home internet connection?
- Many residential ISPs (including most Korean ISPs) block outbound port 25 as an anti-spam measure. Receiving is also a problem: with a dynamic IP, other mail servers readily classify your mail as spam. Using a hosted mail service is the realistic choice.
Related ports
Last updated 2026-11-04 · Use this guide to check systems you manage. Scanning systems without permission may carry legal liability.