SMTP Port Numbers Explained: 25 vs 465 vs 587 vs 2525 (Which to Use)

Email Port Number
On this page
  1. SMTP ports at a glance
  2. What is SMTP?
  3. Port 25 vs 587 vs 465 explained
  4. SMTP settings for popular email providers
  5. IMAP and POP3 ports (for receiving email)
  6. How to send email from a website or app
  7. How to test an SMTP port
  8. SMTP errors and fixes
  9. FAQ

Use port 587 (with STARTTLS) or port 465 (with SSL/TLS) to send email from an app, website or email client. Port 25 is for mail servers talking to each other and is blocked by most home internet providers and cloud hosts. Port 2525 is an unofficial backup that many email-sending services offer when 587 is blocked.

SMTP ports at a glance

PortEncryptionUsed forUse it?
25Optional STARTTLSServer-to-server mail delivery (MTA to MTA)Not from apps or PCs; usually blocked by ISPs
587STARTTLS (upgrades a plain connection to TLS)Message submission from email clients and appsYes, the standard choice
465Implicit SSL/TLS (encrypted from the first byte)Message submission over TLSYes, recommended by RFC 8314 where supported
2525STARTTLSUnofficial alternative submission portOnly if your provider supports it and 587 is blocked

What is SMTP?

SMTP (Simple Mail Transfer Protocol) is the protocol for sending email. When you click Send, your email app hands the message to your provider's SMTP server (the "outgoing mail server"), which finds the recipient's mail server through its DNS MX record and delivers it there over port 25. The recipient then reads it with IMAP or POP3, which are protocols for receiving email.

Port 25 vs 587 vs 465 explained

Port 25

The original SMTP port, still used for delivery between mail servers. Because spammers abused it from infected home PCs, most ISPs and cloud platforms (AWS, Google Cloud, Azure, many VPS hosts) block outgoing port 25 by default. Don't use it to send from your app or website.

Port 587 (submission, STARTTLS)

The official port for email clients and applications to submit mail. The connection starts in plain text and is upgraded to encryption with the STARTTLS command, then you sign in. Every major provider supports it.

Port 465 (SMTPS, implicit TLS)

Originally assigned for SMTP over SSL, then withdrawn, then re-standardized in 2018 by RFC 8314 for submission with implicit TLS: the connection is encrypted before any data is sent. It is just as good as 587, and slightly safer against downgrade attacks. Choose "SSL/TLS" in your app for 465 and "STARTTLS" for 587; mixing them up is the most common cause of connection errors.

Port 2525

Not an official standard, but email services such as SendGrid, Mailgun, Brevo and SMTP2GO accept it as a fallback when a host blocks 587.

ProviderSMTP serverPort / encryptionSign-in
Gmail / Google Workspacesmtp.gmail.com465 SSL or 587 STARTTLS"Sign in with Google" (OAuth) or an app password with 2-Step Verification
Outlook.com / Hotmailsmtp-mail.outlook.com587 STARTTLSModern auth (OAuth) only
Microsoft 365 (work/school)smtp.office365.com587 STARTTLSOAuth recommended; Basic auth for SMTP AUTH is due to be disabled by default from the end of 2026
Yahoo Mailsmtp.mail.yahoo.com465 SSL or 587 STARTTLSApp password
iCloud Mailsmtp.mail.me.com587 STARTTLSApp-specific password
Zoho Mailsmtp.zoho.com (smtp.zoho.eu etc. by region)465 SSL or 587 STARTTLSPassword or app password

Full Gmail details, including sending limits, are in our Gmail IMAP, POP and SMTP settings guide. Always confirm settings in your provider's help pages, since they occasionally change.

IMAP and POP3 ports (for receiving email)

ProtocolEncrypted (use this)Unencrypted (avoid)
IMAP993 (SSL/TLS)143
POP3995 (SSL/TLS)110
SMTP submission465 (SSL/TLS) or 587 (STARTTLS)25 (server relay only)

IMAP keeps mail on the server and syncs every device; POP3 downloads it to one device. For phones and multiple computers, use IMAP.

How to send email from a website or app

  • WordPress and website contact forms: use an SMTP plugin or your host's mail settings with port 587 or 465 and a dedicated mailbox or email service; PHP's built-in mail() often lands in spam.
  • Transactional email services (SendGrid, Mailgun, Amazon SES, Brevo, Postmark): better delivery for receipts, password resets and newsletters; they give you an SMTP host, port 587/465/2525 and an API key as the password.
  • Set up SPF, DKIM and DMARC DNS records for your domain so receiving servers trust your mail. Gmail and Yahoo require them for bulk senders.

How to test an SMTP port

  • Windows (PowerShell): Test-NetConnection smtp.gmail.com -Port 587 → "TcpTestSucceeded : True" means the port is reachable.
  • Mac/Linux: nc -vz smtp.gmail.com 587
  • Check STARTTLS: openssl s_client -starttls smtp -connect smtp.gmail.com:587 (for 465: openssl s_client -connect smtp.gmail.com:465).

SMTP errors and fixes

ErrorLikely causeFix
Connection timed outPort blocked by ISP, firewall or cloud hostSwitch between 587, 465 and 2525; check firewall/antivirus; ask your host to unblock
SSL/TLS handshake error, "wrong version number"Encryption type doesn't match the port465 = SSL/TLS, 587 = STARTTLS
535 Authentication failedWrong password, or the provider requires OAuth/app passwordCreate an app password or use "Sign in with" OAuth
530 Must issue a STARTTLS command firstEncryption not enabledTurn on STARTTLS/TLS in the app
550 / 554 rejected, or mail goes to spamMissing SPF/DKIM/DMARC, sending limits, or a blocklisted IPFix DNS records, use an email service, check sending limits

FAQ

Is port 587 or 465 better?

Both are secure when set up correctly. RFC 8314 slightly prefers 465 (implicit TLS); 587 is the most widely supported. Use whichever your provider lists.

Is SMTP port 25 still used?

Yes, between mail servers. It just shouldn't be used to send from your computer or app.

What port does Gmail SMTP use?

smtp.gmail.com on 465 (SSL) or 587 (STARTTLS).

What is the SMTP port for SSL?

465.

Related guides