What Port 587 Is For
RFC 6409 separates two jobs that once shared port 25: relay between mail servers, and submission of new mail by users. Port 587 is for submission. A mail app or an application connects to the mail server on 587, proves who it is with a user name and password, and hands over the message. The server then delivers it to the recipient's mail server on port 25.
Because a login is required, the server can accept mail for any destination from its own users without becoming an open relay.
How a Session on 587 Works
- The client connects and the server greets with a
220line. - The client sends
EHLOand the server lists what it supports, includingSTARTTLS. - The client sends
STARTTLSand both sides switch to TLS. - The client sends
EHLOagain; the server now also offersAUTH. - The client logs in, then sends the sender, the recipients, and the message.
Many servers offer AUTH only after STARTTLS, so a client that skips encryption cannot log in at all.
587 Compared with 25 and 465
| Port | Job | Login |
|---|---|---|
| 25 | Relay between servers | No |
| 587 | Submission, STARTTLS | Yes |
| 465 | Submission, implicit TLS | Yes |
587 and 465 do the same job; they differ only in when TLS starts. Many outgoing networks restrict port 25 but leave 587 open. The background is in SMTP ports and port 25.
Settings for a Mail Client or Application
| Setting | Value |
|---|---|
| Server | Your mail service's SMTP host |
| Port | 587 |
| Security | STARTTLS |
| Login | Required |
| User name | Often the full mailbox address |
In an application the same values usually go into environment variables or a configuration file, with names such as host, port, user, password, and an encryption setting. Choose "STARTTLS" or "TLS" there, not "SSL", which in many applications means implicit TLS on 465.
Test Port 587 with openssl
First check that the port is reachable, then open a session:
nc -vz -w 5 smtp.example.com 587
openssl s_client -starttls smtp -connect smtp.example.com:587 -crlfopenssl performs the first EHLO and STARTTLS for you and prints the certificate. Then type:
EHLO test.example.comThe answer is a set of lines starting with 250, one per feature. Look for an AUTH line with the login methods the server accepts, such as PLAIN or LOGIN. Type QUIT to leave. More on the tool in openssl s_
Outgoing Firewall Rule
Firewalls on Linux servers usually allow all outgoing traffic. If yours denies outgoing traffic by default, allow 587:
sudo ufw allow out 587/tcpOn firewalld, outgoing traffic is not filtered unless you add rules for it.
Running the Submission Service Yourself
On your own Postfix server, submission on 587 is a separate service defined in /etc/postfix/master.cf. The submission entry ships commented out; when enabled with TLS required and SASL login turned on, usually through Dovecot, it accepts mail from your users. Open incoming 587 in the firewall only on that server.
Common Problems
- Timeout: outgoing 587 is blocked on the client's network or by the server's firewall.
- Certificate warning: the host name in the client does not match the certificate; use the name the certificate was issued for.
- Login refused: wrong credentials, or the account needs an app-specific password.
To send a test message from the shell, see how to send email from the Linux command line.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations