Email Ports Explained: 25 vs 465 vs 587

The three email ports serve different purposes: 25 for server-to-server relay, 587 for user submission with STARTTLS, and 465 for implicit TLS. Using the wrong one causes connection failures.

The reference

25Server-to-server relay (MX delivery)Should NOT be used for user submission
465Implicit TLS submission (user to server)Encrypted from the first byte; recommended
587STARTTLS submission (user to server)Starts plaintext, upgrades to TLS; most common

Which should you use?

  • Configuring your email client: 587 or 465, with authentication (username + password or app password). Both are secure.
  • Server-to-server delivery: port 25, handled automatically by mail servers using MX records.
  • Never expose port 25 to user devices: it’s for infrastructure, and most ISPs block it on consumer lines.

Frequently asked questions

Why is port 25 blocked on my network?+

ISPs and cloud providers block it to prevent spam botnets from sending directly. Use 587/465 through your mail provider instead.

Is 465 more secure than 587?+

465 uses implicit TLS (encrypted immediately); 587 starts plaintext and upgrades. Both are secure when configured correctly; 465 avoids the downgrade window.

What port does Gmail use?+

587 for SMTP submission (smtp.gmail.com) with STARTTLS, or 465 with SSL. Both require authentication.

Can I run my own mail server on port 25?+

Yes, but your ISP must unblock it (business lines usually allow it; consumer lines don’t). You also need correct PTR, SPF, and DKIM.

What happens if I use the wrong port?+

Connection refused or timeout: the server isn’t listening on that port. The error message tells you which port to use.

Does the port affect deliverability?+

No: the port is just transport. Deliverability depends on authentication, reputation, and content.

Last verified: 2026-11-28