On this page
  1. Which SMTP port should you use?
  2. SMTP ports compared: 25, 465, 587 and 2525
  3. Port 587 vs 465: STARTTLS vs implicit TLS
  4. Port 25 blocked on AWS, Google Cloud and Azure
  5. SMTP ports and TLS by email service
  6. Common SMTP port and TLS errors
  7. SMTP ports for IMAP and POP3
  8. FAQ

SMTP Ports: Which One to Use for Sending

Use port 587 with STARTTLS to send from an app; use 465 if your provider or library wants implicit TLS; port 25 is for server-to-server delivery and is often blocked on cloud hosts; 2525 is an unofficial fallback some providers offer when 587 is blocked.

Written by Relay, the Email Stack Review teamPublished No ads or affiliate links
Choosing a service? See the best SMTP relay services.

Key takeaways

  • Start with 587 and STARTTLS. Switch to 465 only if your library or provider asks for implicit TLS.
  • Port 25 is the server-to-server port. AWS, Google Cloud and Azure restrict it by default, with different rules.
  • Port 2525 is not an SMTP port in the IANA registry. Providers add it as a fallback, and 15 of the 21 services in our table list it.
  • Match the TLS mode to the port. A mismatch shows up as a handshake error or a hang.

An SMTP port is the TCP port your app connects to when it sends mail. Four numbers cover almost every case: 25, 465, 587 and 2525. This page says which to use, what each is for, which cloud blocks 25, and what 21 email services list in their SMTP docs.

Which SMTP port should you use?

Use port 587 with STARTTLS for app sending, because it is the port reserved for message submission. RFC 6409 says "Port 587 is reserved for email message submission" (checked November 2026). Switch to 465 or 2525 only when your library or network makes you.

Situation Port TLS mode
Sending from an app (default) 587 STARTTLS
Your library or provider wants TLS from the first byte 465 Implicit TLS
587 is blocked on your network or host 2525, or 465 STARTTLS on 2525 where the provider lists it (see the table by service); implicit TLS on 465
Server-to-server delivery between mail servers 25 STARTTLS optional

Never send a login in clear text. Whatever the port, turn encryption on, and check the provider's table below for the mode it expects. If the connection fails, see common errors.

SMTP ports compared: 25, 465, 587 and 2525

The four SMTP ports have four different roles: 25 carries server-to-server mail, 587 is for message submission, 465 is for submission over implicit TLS, and 2525 is not assigned to SMTP at all. The default SMTP port is 25 for server-to-server delivery and 587 for sending from an app.

Port Official role Encryption Used for Often blocked?
25 MTA-to-MTA delivery; IANA name smtp, defined by RFC 5321 STARTTLS optional Mail servers handing mail to each other Yes on AWS EC2, Google Cloud (external destinations) and Azure (except Enterprise Agreement and MCA-E); see below
587 Message submission; IANA name submission, RFC 6409 STARTTLS Apps and mail clients sending mail Google Cloud places no restriction on it
465 Message submission over TLS; IANA name submissions, RFC 8314 Implicit TLS Apps and clients whose library or provider wants TLS from the first byte Google Cloud places no restriction on it
2525 Not assigned to SMTP; the IANA registry lists it as ms-v-worlds Depends on the provider A fallback some providers offer when 587 is blocked Not covered by the cloud docs below

Sources: RFC 5321 (section 4.5.4.2, port 25), RFC 6409 (section 3.1), RFC 8314 (section 3.3) and the IANA port registry, updated November 24, 2026, all checked November 28, 2026. The IANA registry also lists a separate older assignment for 465 (urd), which is why you will see two names for that port.

Some providers add their own ports on top. Resend lists 2465 and 2587, SMTP2GO lists 8025, 8465, 80 and 443, and Mailjet lists 80 and 588. They are all in the table by service.

Port 587 vs 465: STARTTLS vs implicit TLS

Port 587 uses STARTTLS, which starts a plain connection and upgrades it with a command, while port 465 uses implicit TLS, which encrypts from the first byte. Both are fine when the client checks the server's certificate.

STARTTLS is defined in RFC 3207: after the client sends the STARTTLS command, the server answers "220 Ready to start TLS" and the handshake begins. On 465, RFC 8314 (section 3.3) says a TLS handshake begins immediately when the connection opens.

Which is more secure? RFC 8314 prefers implicit TLS over connecting to the cleartext port and negotiating TLS with STARTTLS. Its Appendix A points to the STARTTLS command injection vulnerability and calls STARTTLS a less secure architecture than implicit TLS. For the transition period it says clients and servers should implement both (all checked November 2026). In practice that means: use STARTTLS on 587 and require it, so the client fails instead of sending in the clear, and use 465 if your provider offers it and you want encryption from the start.

"SSL" and "TLS" in a settings screen are usually shorthand for the two modes. Client libraries show it:

  • Nodemailer says to set secure to true when connecting to port 465, and to leave it false for 587 or 25 and let STARTTLS upgrade the connection (Nodemailer docs).
  • Python's smtplib has SMTP_SSL for cases where SSL is required from the beginning of the connection, and SMTP.starttls() for the upgrade (Python docs).
  • PHPMailer pairs ENCRYPTION_SMTPS (implicit TLS) with port 465, and ENCRYPTION_STARTTLS with 587 (PHPMailer README).

All three checked November 28, 2026. SMTPS is the name for SMTP over implicit TLS; the IANA service name for port 465 is submissions.

Port 25 blocked on AWS, Google Cloud and Azure

Port 25 is blocked or restricted by default on AWS EC2, Google Cloud and Azure, with different exceptions on each. The fix is to send through a relay on 587 or 465 instead of from your own server.

Cloud Outbound port 25 policy How to lift it, or what to use instead
AWS EC2 AWS blocks outbound traffic on port 25 by default for all EC2 instances and Lambda functions on elastic network interfaces. Submit a request to AWS; the page says requests take up to 48 hours to process. (AWS re:Post, checked November 28, 2026)
Google Compute Engine Connections to destination TCP port 25 are blocked when the destination is outside your VPC network, "due to the risk of abuse". Google does not restrict external traffic on destination ports 587 or 465. It says some projects do not have the restriction and links to a "Blocked and limited traffic" page; the page we read describes no removal request. (Google Cloud docs, checked November 28, 2026)
Microsoft Azure The platform blocks outbound SMTP on port 25 for deployed VMs. Enterprise Agreement and MCA-E subscriptions are not blocked. On Enterprise Dev/Test the block can be removed. Use the "Cannot send email (SMTP-Port 25)" section under Diagnose and Solve in the virtual network resource. Microsoft recommends authenticated SMTP relay services for sending from Azure VMs. (Microsoft Learn, checked November 28, 2026)

So the practical route on all three is the same: send through an authenticated relay on 587 or 465. Our list of best SMTP relay services compares them, and what an SMTP relay is explains the idea. Running your own mail server is the other route, covered in can I run my own SMTP server.

SMTP ports and TLS by email service

The table below lists the SMTP host, ports, TLS mode and login for 21 email services, one row per tool, copied from each vendor's SMTP docs. "Not stated" means the docs we checked are silent.

Tool SMTP host Ports TLS Login Checked
Mailtrap live.smtp.mailtrap.io (transactional); bulk.smtp.mailtrap.io (bulk) 587, 25, 2525, 465 STARTTLS on 587, 25 and 2525; implicit TLS on 465 username 'api', password = API token 2026-11-30
Amazon SES email-smtp.<region>.amazonaws.com (one endpoint per AWS region) 25, 587, 2587, 465, 2465 STARTTLS on 25/587/2587; TLS Wrapper on 465/2465; TLS required; 2525 not listed SMTP credentials derived from IAM (or Mail Manager SMTP credentials) 2026-11-28
Mailgun smtp.mailgun.org 25, 465, 587, 2525 465 SSL/TLS; 587 and 2525 STARTTLS SMTP credentials of the domain (or API key) 2026-11-10
Postmark smtp.postmarkapp.com 25, 2525, 587 STARTTLS Server API token as username and password 2026-11-10
SendGrid smtp.sendgrid.net 25, 587, 2525, 465 25/587/2525 unencrypted or TLS (587 recommended); 465 SSL username 'apikey', password = API key 2026-11-28
Resend smtp.resend.com 25, 465, 587, 2465, 2587 Implicit TLS (SMTPS) on 465 and 2465; STARTTLS on 25, 587 and 2587 Username 'resend', password = API key 2026-11-10
Brevo smtp-relay.brevo.com 587, 2525, 465 Port 465 with SSL/TLS; 587 and 2525 with encryption left empty (non-encrypted, per Brevo) SMTP key (not an API key) 2026-11-10
Mailjet in-v3.mailjet.com 25, 80, 465, 587, 588, 2525 465 SSL only; others TLS optional API key public as login, private as password 2026-11-28
MailerSend smtp.mailersend.net 587, 2525 STARTTLS, TLS 1.2 and 1.3 SMTP username and password per domain 2026-11-28
SparkPost eu1.smtp.bird.com 465, 587, 2525 Implicit TLS on 465; STARTTLS on 587 and 2525 API key 2026-11-10
SMTP2GO mail.smtp2go.com 25, 2525, 8025, 587, 80, 465, 8465, 443 TLS on 25, 2525, 8025, 587, 80; SSL on 465, 8465, 443 SMTP user and password (default); IP authentication available 2026-11-10
Elastic Email smtp.elasticemail.com 25, 2525, 587, 465 465 SSL/TLS (Thunderbird guide); other ports listed without TLS mode SMTP credential (created in Settings > SMTP) as username and its password 2026-11-10
Mandrill smtp.mandrillapp.com 25, 587, 2525 (STARTTLS available); 465 for SSL not stated separately (see ports) login or plain; username: any string (account primary contact email recommended); password: any active API key 2026-11-25
SMTP.com send.smtp.com (typical; your account settings show the exact host) 25, 2525, 2082, and 465 with SSL 'Encryption' is an account setting; vendor warns of lower sending speed with it on; blog advises requiring TLS per-sender login and password (Manage Senders) or Allowed IPs (no auth) 2026-11-25
ZeptoMail smtp.zeptomail.com 465 (SSL) or 587 (TLS) TLS 1.2 only username 'emailapikey' (or From address with a shorter password) 2026-11-11
SendLayer smtp.sendlayer.net 587 not stated username and password from Settings > SMTP Credentials, created automatically when a domain is authorized 2026-11-25
SocketLabs not stated 25, 2525, 465, 587 465 SSL, 587 TLS (page wording) credentials or IP allow-listing (no auth) 2026-11-28
turboSMTP pro.turbo-smtp.com (global); pro.eu.turbo-smtp.com (EU) 587, 2525, 25, 465, 25025 STARTTLS on 587 (recommended), 2525, 25; implicit TLS on 465 and 25025 Consumer Key as username, Consumer Secret as password 2026-11-28
MailChannels smtp.mailchannels.net 587 TLS on 587 (Email API relay); Outbound Filtering relay also lists 25, 2525, 465 account ID as username, SMTP password created in dashboard 2026-11-28
MailPace smtp.mailpace.com 587 TLS/STARTTLS on 587 server API token as username and password 2026-11-28
AuthSMTP mail.authsmtp.com ('typically'; use host shown in control panel) 587, 2525, 465, 25, 23, 26, 325 STARTTLS on 587/2525; implicit TLS on 465; 325 non-SSL only; 25 not recommended username 'ac' + 5 digits and password; sender addresses must be authorised in the control panel 2026-11-28

From each vendor's SMTP docs, checked November 10, 11, 25 and 28, 2026 (the date in the last column is when that row was checked; the tool index holds the source URL for each). Values are copied as the docs word them, so some cells keep the vendor's own caveats.

Three rows need a note. The SMTP.com knowledge base list of supported ports does not include 587. Brevo's docs list 587 and 2525 as the non-encrypted ports and 465 for SSL/TLS. Amazon SES has one SMTP endpoint per AWS region, in the form email-smtp.<region>.amazonaws.com; use the region where you verified your domain.

Which services offer 2525? Fifteen of the 21 list it for their main SMTP service: Mailtrap, SendGrid, Mailgun, Postmark, Brevo, Mailjet, MailerSend, SparkPost, SMTP2GO, Elastic Email, Mandrill, SMTP.com, SocketLabs, turboSMTP and AuthSMTP. MailChannels lists it only on its Outbound Filtering relay. Amazon SES says 2525 is not listed, and Resend, ZeptoMail, SendLayer and MailPace do not list it.

Common SMTP port and TLS errors

Most SMTP connection errors come from five causes: a blocked port, a firewall, a TLS mode that does not match the port, the wrong host, or wrong credentials. Match the symptom in the table to the likely cause.

Symptom Likely cause Fix
Timeout on port 25 Outbound port 25 is blocked by your cloud, host or network Send through a relay on 587 or 465 (cloud policies)
Timeout on port 587 A firewall or the host blocks it Try 2525 or 465 if your service lists them (table)
A TLS handshake error or a hang on 465 The client expects STARTTLS on a port that starts TLS at once. The reverse mix-up on 587 gives a similar failure Use implicit TLS for 465 (secure: true in Nodemailer, SMTP_SSL in smtplib) and STARTTLS for 587 (above)
Certificate name mismatch You connected to a host name the certificate does not cover Use the exact host from your provider's docs (table)
Authentication failed after connecting The port worked; the credentials did not Check the username format and password or API key for your service (table); RFC 6409 expects an authenticated session

To test a port from a shell, run one of these two commands with your provider's host in place of smtp.example.com:

openssl s_client -starttls smtp -connect smtp.example.com:587
openssl s_client -connect smtp.example.com:465

The first connects with STARTTLS, the second with implicit TLS. If either hangs, the port is probably blocked before it reaches the provider. These are instructions for you to run, not output we recorded.

SMTP ports for IMAP and POP3

SMTP sends mail; IMAP and POP3 read it. They are different protocols with their own ports, so an SMTP port will not work in an IMAP or POP3 setting, or the other way round. If a settings screen asks for both, fill in the sending server with an SMTP port from this page and the reading server with the ports your mailbox provider gives for IMAP or POP3.

How we compared: RFCs, the IANA registry, cloud docs and each vendor's SMTP docs, checked November 28, 2026. We ran no sending tests, and the site has no ads, affiliate links or paid placements.

Know your port and ready to pick a service? See the best SMTP relay services.

SMTP ports: FAQ

Which SMTP port should I use?

Use port 587 with STARTTLS to send from an app. Use 465 if your provider or library wants implicit TLS, 25 only for server-to-server delivery, and 2525 as a fallback when 587 is blocked. See the decision table.

What is the difference between port 587 and 465?

Port 587 starts unencrypted and upgrades with STARTTLS, while 465 is encrypted from the first byte. RFC 8314 prefers implicit TLS, but both work when the certificate is checked. See 587 vs 465.

Is port 25 blocked, and why?

Yes, often. AWS blocks outbound port 25 on EC2 by default, Google Cloud blocks it to external destinations and Azure blocks it for deployed VMs except on Enterprise Agreement and MCA-E subscriptions. Google cites the risk of abuse. Send through a relay on 587 or 465 instead. See port 25 blocked.

What is SMTP port 2525?

Port 2525 is not an SMTP port: the IANA registry assigns it to something else. Some providers offer it as a fallback when 587 is blocked, and 15 of the 21 services in our table list it. See SMTP ports and TLS by email service.

What is the default SMTP port?

Port 25 is the default for server-to-server delivery, as RFC 5321 says. For sending from an app, the port to use is 587. See the ports comparison.

What is the difference between SMTP, SMTPS and STARTTLS?

SMTP is the protocol that moves mail. SMTPS is SMTP over implicit TLS, on port 465. STARTTLS is the command that upgrades a plain SMTP connection to TLS, used on 587 and 25. See 587 vs 465.

What are the SMTP ports for Gmail and Outlook?

Those are mailbox settings, a different setup from sending through a relay service. Our free SMTP servers page covers mailbox SMTP.

Why does my SMTP connection time out?

Usually the port is blocked: port 25 by your cloud or host, or 587 by a firewall. Try 465 or 2525 if your service lists them, or test the port with the commands above. See common errors.