Port 25 is SMTP, the port mail servers use to deliver email to each other. Clients sending mail through their provider should use 587 or 465 instead. It is normally meant to be reachable from the internet.
- Port
- 25
- Protocol
- TCP
- Service
- SMTP
- Expose to internet?
- Yes, usually
- Also used by
- Postfix, Exim, Microsoft Exchange, Sendmail
Is port 25 safe to open?
A server that receives email for a domain must accept connections on port 25. The danger is an open relay: a misconfigured server that forwards mail for anyone, which gets abused for spam and quickly blacklisted. Exposed SMTP also attracts password guessing if authentication is offered on it.
How to secure SMTP
- Make sure the server relays only for your own users and networks. In Postfix check
mynetworksandsmtpd_relay_restrictions. - Offer STARTTLS with a valid certificate.
- Do not offer authentication on port 25; require it on 587 or 465.
- Publish SPF, DKIM and DMARC records for your domains.
- If the machine does not receive mail, bind the MTA to localhost only (Postfix
inet_interfaces = loopback-only).
Check if port 25 is open
Linux: what is listening on this port
sudo ss -tlpn | grep ':25 'Windows (PowerShell): what is listening
Get-NetTCPConnection -LocalPort 25 -State Listen | Select-Object LocalAddress, OwningProcess, @{n='Process';e={(Get-Process -Id $_.OwningProcess).Name}}From another machine: is it reachable
nc -zv HOST 25
# or
nmap -p 25 HOST
# Windows
Test-NetConnection HOST -Port 25Test the SMTP service itself
openssl s_client -starttls smtp -connect HOST:25 -crlfOpen port 25 in the firewall
ufw (Ubuntu, Debian)
sudo ufw allow 25/tcpfirewalld (RHEL, Rocky, Alma, Fedora)
sudo firewall-cmd --permanent --add-port=25/tcp
sudo firewall-cmd --reloadWindows Firewall (PowerShell, as Administrator)
New-NetFirewallRule -DisplayName "Allow 25/TCP" -Direction Inbound -Protocol TCP -LocalPort 25 -Action AllowMonitor port 25
Add a TCP port monitor for 25 and Statance connects to it from up to six regions, alerting you by email, Slack, Discord or PagerDuty when SMTP stops answering. TCP port monitoring.
Related ports
| Port 587 | SMTP submission | Low risk |
| Port 465 | SMTPS (mail submission over TLS) | Low risk |
| Port 993 | IMAPS | Low risk |
FAQ
Why can’t I send email on port 25 from my cloud server?
Many cloud and residential providers block or restrict outbound port 25 to stop spam. Send through a relay or email provider on port 587 or 465, or ask your provider to lift the block.
What is the difference between port 25, 465 and 587?
Port 25 is for server-to-server delivery. Ports 587 (STARTTLS) and 465 (implicit TLS) are for authenticated clients submitting mail to their own server.
What is port 25 used for?
Port 25 is SMTP, the port mail servers use to deliver email to each other. Clients sending mail through their provider should use 587 or 465 instead. It is also used by Postfix, Exim, Microsoft Exchange, Sendmail.
Is it safe to open port 25?
Usually, yes. A server that receives email for a domain must accept connections on port 25. The danger is an open relay: a misconfigured server that forwards mail for anyone, which gets abused for spam and quickly blacklisted. Exposed SMTP also attracts password guessing if authentication is offered on it.
Is port 25 TCP or UDP?
SMTP uses TCP on port 25.
How do I check if port 25 is open?
On the server, run sudo ss -tulpn | grep ':25 ' (Linux) or Get-NetTCPConnection -LocalPort 25 (Windows) to see what is listening. From another machine, run nc -zv HOST 25 or Test-NetConnection HOST -Port 25.
Know the moment a port stops answering.
TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.