Toolman

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.

PortProtocolNameWhat it is for
25TCPSMTPServer-to-server mail transfer.
465TCPSMTPSMail submission over implicit TLS.
587TCPSMTP submissionThe 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

Port 25 in full · Port 465 in full · Port 587 in full · Every service · All port numbers