What port does SMTP use?
SMTP uses 25, 465 and 587, and which one depends on what you are doing.
Three ports, three jobs. Getting them mixed up is the usual cause of mail that will not send.
| Port | Protocol | Name | What it is for |
|---|---|---|---|
| 25 | TCP | SMTP | Server-to-server mail transfer. |
| 465 | TCP | SMTPS | Mail submission over implicit TLS. |
| 587 | TCP | SMTP submission | The port applications and mail clients use to send outbound mail, with authentication and STARTTLS. |
Exposing it
Most residential ISPs and cloud providers block outbound 25 to limit spam. For sending mail from an application use port 587 with authentication.
Checking it is listening
sudo lsof -i :25 # macOS, Linux
netstat -ano | findstr :25 # Windows
nc -zv host 25 # from elsewhere
An "address already in use" error on a port nothing appears to be holding usually means the socket is in TIME_WAIT rather than that a process has it — the ports reference covers that and the ephemeral range.
Frequently asked questions
What port does SMTP use?
SMTP uses ports 25, 465, 587, and they do different jobs. 25: Server-to-server mail transfer. 465: Mail submission over implicit TLS. 587: The port applications and mail clients use to send outbound mail, with authentication and STARTTLS.
Is port 25 safe to expose to the internet?
Most residential ISPs and cloud providers block outbound 25 to limit spam. For sending mail from an application use port 587 with authentication.
How do I check whether SMTP is listening?
sudo lsof -i :25 on macOS or Linux, netstat -ano | findstr :25 on Windows. From another machine, nc -zv host 25 says whether anything answers.
Other services
- What port does IMAP use?
- What port does POP3 use?
- What port does LDAP use?
- What port does HTTP use?
- What port does HTTPS use?
- What port does FTP use?
- What port does DHCP use?
- What port does Docker use?
- What port does MQTT use?
- What port does SSH use?
- What port does RDP use?
- What port does MySQL use?
Port 25 in full · Port 465 in full · Port 587 in full · Every service · All port numbers