Port 25: SMTP
TCP 25 is the port for Simple Mail Transfer Protocol (server-to-server relay). Required on inbound mail servers (MX hosts); otherwise keep it closed. Never run an open relay.
| Service | Simple Mail Transfer Protocol (server-to-server relay) |
|---|---|
| Protocol | TCP |
| Exposure risk | Medium: expose with care |
| Secure alternative | STARTTLS on the same port; clients should submit on 587 or 465 |
| Range | Well-known (0–1023): binding needs root/admin on Unix |
What port 25 does
Mail servers deliver messages to each other on port 25. Receiving mail servers must accept connections here. Most residential ISPs and cloud providers (AWS, Google Cloud, Azure) block outbound 25 by default to stop spam from compromised machines.
Should port 25 be open?
Required on inbound mail servers (MX hosts); otherwise keep it closed. Never run an open relay. Where you can, use STARTTLS on the same port; clients should submit on 587 or 465 instead.
Find what's listening on port 25
- Linux:
sudo ss -tulpn | grep :25 - macOS:
sudo lsof -nP -i :25 - Windows:
netstat -ano | findstr :25, then look up the PID in Task Manager.
Open or block it in a firewall
- ufw:
sudo ufw allow 25/tcp(ordeny) - firewalld:
sudo firewall-cmd --add-port=25/tcp --permanent && sudo firewall-cmd --reload - Windows:
New-NetFirewallRule -DisplayName "Port 25" -Direction Inbound -Protocol TCP -LocalPort 25 -Action Allow
Port assignment per the IANA Service Name and Transport Protocol Port Number Registry. Test several ports at once with the port scanner, or any port with the open port checker.
Questions about port 25
What is port 25 used for?
Is port 25 TCP or UDP?
Is it safe to open port 25?
How do I check if port 25 is open?
nc -vz host 25 (macOS/Linux) or Test-NetConnection host -Port 25 (PowerShell). To see what is listening on your own machine, run ss -tulpn | grep :25 (Linux) or netstat -ano | findstr :25 (Windows).