Skip to content

BlogSMTP

SMTP ports explained: 25, 465, 587 and 2525

Pick the wrong SMTP port and the connection hangs, times out or fails with a TLS error. To send from an app or email client, use 587 with STARTTLS or 465 with SSL/TLS. Leave port 25 to mail servers, since most cloud hosts block it. The exact settings for Gmail, Outlook, Yahoo and iCloud are near the end.

Julien Coulaud on X

Founder of Shipmail, the email platform for businesses and their AI agents. Every guide here draws on mail servers running in production.

  • SMTP
  • Email ports
  • STARTTLS
  • TLS
  • Email clients

Short answer

Use port 587 or port 465 to send email from an app or email client. Port 587 starts unencrypted and switches to TLS with the STARTTLS command. Port 465 starts encrypted from the first byte, which is called implicit TLS. Port 25 is for mail servers relaying to each other, and most home internet providers and cloud hosts block it for outgoing mail. Port 2525 isn't standard, but some sending services offer it as a backup.

Which SMTP port should you use?

For an email client, a website contact form, a printer or an app, use 587 or 465, whichever your provider lists. Both require a sign-in and both encrypt the connection. If the provider lists both, either works. RFC 8314 prefers 465, because the connection is encrypted before anything is sent.Sources[2]RFC 6409: Message Submission for Mail[3]RFC 8314: Cleartext considered obsolete, TLS for email[4]RFC 3207: SMTP service extension for secure SMTP over TLS

  • Port 587 with STARTTLS: the default for most providers and apps.
  • Port 465 with SSL/TLS: use it when your provider supports it.
  • Port 25: leave it to mail servers. Your network probably blocks it anyway.
  • Port 2525: only if your sending service documents it and 587 and 465 are blocked.
Sources[2]RFC 6409: Message Submission for Mail[3]RFC 8314: Cleartext considered obsolete, TLS for email[1]RFC 5321: Simple Mail Transfer Protocol[9]Twilio SendGrid: integrating with the SMTP API

SMTP ports at a glance

PortWhat it's forEncryptionUse it when
587Sources[2]RFC 6409: Message Submission for Mail[4]RFC 3207: SMTP service extension for secure SMTP over TLSSubmission: your app or client hands mail to its providerSTARTTLS (starts plain, upgrades to TLS)Your provider lists 587, or your app only offers STARTTLS
465[3]Submission over TLSImplicit TLS (encrypted from the start)Your provider supports it. The standard prefers it
25Sources[1]RFC 5321: Simple Mail Transfer Protocol[2]RFC 6409: Message Submission for MailRelay: mail servers passing mail to each otherOptional STARTTLSYou run a mail server. Not for apps or email clients
2525Sources[9]Twilio SendGrid: integrating with the SMTP API[10]Postmark: send email with SMTPUnofficial alternative offered by some sending servicesUsually STARTTLSYour service offers it and 587 is blocked on your network

Relay vs submission: why there are two kinds of SMTP port

Sending an email takes two hops. First your email client or app submits the message to your provider's server. Then that server relays it to the recipient's mail server. Both hops speak SMTP, but they happen on different ports and follow different rules.Sources[2]RFC 6409: Message Submission for Mail[1]RFC 5321: Simple Mail Transfer Protocol

RFC 6409 reserves port 587 for submission and says relay continues to use port 25. A submission server must, by default, refuse to accept mail until you have signed in. A relay server on port 25 accepts mail from other servers without a login, because it is the front door for mail addressed to its own domain.Sources[2]RFC 6409: Message Submission for Mail[1]RFC 5321: Simple Mail Transfer Protocol

Port 25: server-to-server relay

Port 25 is the original SMTP port, assigned by IANA. Mail servers that receive mail from the internet listen on it. When one provider delivers a message to another provider's server, it connects on port 25.[1]

Port 25 takes mail without a login, so an infected computer or a hijacked server can use it to send spam straight to other mail servers. That's why so many networks block outgoing port 25. Your app should not need it. It should sign in to a submission server on 587 or 465 and let that server relay.[2]

Port 587 and STARTTLS

On port 587, the connection starts in plain text. The client sends the STARTTLS command, the server answers 220 Ready to start TLS, and the two sides switch to an encrypted connection before the client signs in or sends any mail. After the switch, the client starts the conversation again with a fresh EHLO.Sources[4]RFC 3207: SMTP service extension for secure SMTP over TLS[2]RFC 6409: Message Submission for Mail

In most email clients this setting is called STARTTLS or TLS. Gmail, Outlook.com, Microsoft 365, Yahoo and iCloud all accept port 587.Sources[11]Google Workspace: set up Gmail with a third-party email client[12]Microsoft: POP, IMAP, and SMTP settings for Outlook.com[14]Microsoft Learn: send email from a device or application with Microsoft 365[15]Yahoo Help: POP access settings and instructions for Yahoo Mail[16]Apple Support: iCloud Mail server settings for other email apps

Port 465 and implicit TLS

On port 465, the TLS handshake starts the moment the client connects, before any SMTP command. RFC 8314 calls this implicit TLS and prefers it to STARTTLS. Nothing travels in plain text, so there is no upgrade step to tamper with.[3]

Port 465 was briefly registered for SMTP over SSL, then the registration was revoked, but mail software kept using it for submission. RFC 8314 registered it again, this time for message submission over TLS. In most email clients the setting is called SSL/TLS or SSL.[3]

SSL vs STARTTLS: which is more secure?

Both end with the same TLS encryption. The difference is when it starts. SSL/TLS (port 465) encrypts from the first byte. STARTTLS (port 587) opens a plain connection, then upgrades it. RFC 8314 prefers implicit TLS, and asks clients and servers to support both ports while software catches up.Sources[3]RFC 8314: Cleartext considered obsolete, TLS for email[4]RFC 3207: SMTP service extension for secure SMTP over TLS

The name SSL is a leftover. Email clients still label the option SSL or SSL/TLS, but a modern connection uses TLS. The setting has to match the port: choose SSL/TLS for 465 and STARTTLS for 587. Mixing them up is a common reason for a connection that hangs or fails with a TLS error.[3]

Why ISPs and cloud hosts block port 25

ISPs and cloud hosts block outgoing port 25 because it accepts mail without a login, so an infected machine can use it to send spam. Amazon EC2, Google Cloud, Azure and Comcast Xfinity all block it and point you to port 587 instead.Sources[5]AWS: Amazon EC2 restriction on email sent using port 25[6]Google Cloud: sending email from a Compute Engine instance[7]Microsoft Learn: troubleshoot outbound SMTP connectivity in Azure[8]Xfinity: why is port 25 for email submission not supported?

  • Amazon EC2 blocks outgoing port 25 traffic to public IP addresses by default. You can ask AWS to remove the restriction.
  • Google Cloud blocks connections to port 25 outside your VPC network, and does not restrict ports 587 and 465.
  • Azure blocks outgoing port 25 from virtual machines on most subscription types, and recommends an authenticated relay on port 587 instead.
  • Comcast Xfinity does not support port 25 for email from residential customers, and recommends port 587 with TLS.
Sources[5]AWS: Amazon EC2 restriction on email sent using port 25[6]Google Cloud: sending email from a Compute Engine instance[7]Microsoft Learn: troubleshoot outbound SMTP connectivity in Azure[8]Xfinity: why is port 25 for email submission not supported?

If your app times out when it connects to a mail server, check the port before anything else. Switching from 25 to 587 or 465 with a username and password fixes most of these cases.Sources[6]Google Cloud: sending email from a Compute Engine instance[7]Microsoft Learn: troubleshoot outbound SMTP connectivity in Azure

Port 2525: the unofficial backup

Port 2525 is not one of the ports the email standards define. Some sending services listen on it anyway, as a way around networks that block 25 and 587. SendGrid accepts 25, 587 and 2525 for unencrypted or STARTTLS connections and 465 for SSL. Postmark accepts 25, 2525 and 587, and suggests trying each one if a port is congested or blocked by your ISP.Sources[2]RFC 6409: Message Submission for Mail[3]RFC 8314: Cleartext considered obsolete, TLS for email[9]Twilio SendGrid: integrating with the SMTP API[10]Postmark: send email with SMTP

Use 2525 only if your provider documents it. Gmail, Outlook.com, Microsoft 365, Yahoo and iCloud do not list it, so connecting to them on 2525 will fail.Sources[11]Google Workspace: set up Gmail with a third-party email client[12]Microsoft: POP, IMAP, and SMTP settings for Outlook.com[14]Microsoft Learn: send email from a device or application with Microsoft 365[15]Yahoo Help: POP access settings and instructions for Yahoo Mail[16]Apple Support: iCloud Mail server settings for other email apps

SMTP settings for common providers

Most providers accept mail from apps on port 587 with STARTTLS, and many also on port 465 with SSL. Gmail uses smtp.gmail.com, Outlook.com uses smtp-mail.outlook.com and Yahoo Mail uses smtp.mail.yahoo.com.Sources[11]Google Workspace: set up Gmail with a third-party email client[12]Microsoft: POP, IMAP, and SMTP settings for Outlook.com[15]Yahoo Help: POP access settings and instructions for Yahoo Mail

  • Gmail: smtp.gmail.com, port 465 with SSL or 587 with TLS. Sign in with your full address and an app password or OAuth.
  • Outlook.com: smtp-mail.outlook.com, port 587 with STARTTLS. Modern authentication (OAuth) is required.
  • Microsoft 365: smtp.office365.com, port 587 with STARTTLS. Microsoft says a device that only uses port 465 will not work.
  • Yahoo Mail: smtp.mail.yahoo.com, port 465 or 587 with SSL. Sign in with a generated app password.
  • iCloud Mail: smtp.mail.me.com, port 587 with SSL, or STARTTLS if SSL fails. Sign in with an app-specific password.
  • SendGrid: smtp.sendgrid.net, port 587, 2525 or 25 with TLS, or 465 with SSL. The username is apikey.
  • Postmark: smtp.postmarkapp.com, port 587, 2525 or 25.
Sources[11]Google Workspace: set up Gmail with a third-party email client[12]Microsoft: POP, IMAP, and SMTP settings for Outlook.com[13]Microsoft: modern authentication now needed for Outlook.com in other apps[14]Microsoft Learn: send email from a device or application with Microsoft 365[15]Yahoo Help: POP access settings and instructions for Yahoo Mail[16]Apple Support: iCloud Mail server settings for other email apps[9]Twilio SendGrid: integrating with the SMTP API[10]Postmark: send email with SMTP

Our Gmail and Outlook guides cover the sign-in rules, app passwords and sending limits for those two in detail.

SMTP ports in Shipmail

Shipmail mailboxes accept both submission ports. The outgoing server is mx1.shipmail.to, port 465 with SSL/TLS, or port 587 with STARTTLS. Sign in with the full email address and the mailbox password or an app password. Incoming mail uses IMAP on port 993 on the same host.[17]

If your app runs on a host that blocks SMTP ports, skip SMTP. Shipmail's email API sends over HTTPS from a subdomain such as notify.example.com, with TypeScript and Python SDKs, signed delivery webhooks, and replies that land in a mailbox you choose.Sources[18]Shipmail transactional email documentation[19]Shipmail webhooks documentation

Sources19 sourcesVerified 2026-11-09
  1. [1]
    RFC 5321: Simple Mail Transfer Protocol

    Section 2.4: the local-part of a mailbox MUST be treated as case sensitive, though exploiting that case sensitivity impedes interoperability and is discouraged; mailbox domains follow DNS rules and are not case sensitive. Section 5.1: a sending server first looks up the MX records for the destination domain. Section 4.1.2: a domain is made of labels of letters, digits and hyphens. Section 4.5.3.1: local-part up to 64 octets, domain up to 255 octets, a path up to 256 octets including punctuation. Section 4.5.4.2: the SMTP port is specified by IANA as port 25.

    rfc-editor.org · 2026-10-11

  2. [2]
    RFC 6409: Message Submission for Mail

    Port 587 is reserved for email message submission. A Message Submission Agent (MSA) accepts messages from mail user agents; message relay is unaffected and continues to use SMTP over port 25. The MSA must, by default, reject the MAIL command when the session has not been authenticated.

    rfc-editor.org · 2026-10-11

  3. [3]
    RFC 8314: Cleartext considered obsolete, TLS for email

    Implicit TLS starts the TLS handshake immediately on port 993 for IMAP, 995 for POP3, and 465 for message submission; clients and servers should also implement STARTTLS on port 587 during the transition. Section 1 prefers Implicit TLS to negotiating TLS with STARTTLS on a cleartext port. Section 7.3: port 465 was briefly registered as smtps, the registration was revoked and the port reassigned, and this document registers it for submission over TLS.

    rfc-editor.org · 2026-10-11

  4. [4]
    RFC 3207: SMTP service extension for secure SMTP over TLS

    Defines STARTTLS for SMTP. After the client sends STARTTLS, the server can answer 220 Ready to start TLS, and the client must start TLS negotiation before any other command. Both sides discard what they learned before the handshake, and the client should send EHLO again as its first command after TLS.

    rfc-editor.org · 2026-10-11

  5. [5]
    AWS: Amazon EC2 restriction on email sent using port 25

    By default, Amazon EC2 allows outbound traffic over port 25 only to private IPv4 addresses; traffic over port 25 to public IPv4 and IPv6 addresses is blocked. Customers can request that the restriction be removed.

    docs.aws.amazon.com · 2026-10-11

  6. [6]
    Google Cloud: sending email from a Compute Engine instance

    Connections to destination TCP port 25 are blocked when the destination is outside the VPC network. Google Cloud places no restrictions on traffic to external addresses on ports 587 and 465. Port 2525 appears only as an example of a custom port in a firewall rule.

    docs.cloud.google.com · 2026-10-11

  7. [7]
    Microsoft Learn: troubleshoot outbound SMTP connectivity in Azure

    Azure blocks outbound SMTP on TCP port 25 for virtual machines on subscription types other than Enterprise Agreement and MCA-E, and by default on Enterprise Dev/Test. Microsoft recommends an authenticated SMTP relay service, typically on port 587, which is not restricted on any subscription type.

    learn.microsoft.com · 2026-10-11

  8. [8]
    Xfinity: why is port 25 for email submission not supported?

    Comcast does not support port 25 for the transmission of email by its residential internet customers, and recommends port 587 with TLS/SSL enabled.

    xfinity.com · 2026-11-01

  9. [9]
    Twilio SendGrid: integrating with the SMTP API

    SMTP host smtp.sendgrid.net; ports 25, 2525 or 587 for unencrypted or TLS connections, and 465 for SSL. The username is the string apikey and the password is an API key.

    twilio.com · 2026-10-11

  10. [10]
    Postmark: send email with SMTP

    Postmark's SMTP server is smtp.postmarkapp.com for transactional messages, on port 25, 2525 or 587. A port can be congested or blocked by a specific ISP, so Postmark suggests trying each available port.

    postmarkapp.com · 2026-10-11

  11. [11]
    Google Workspace: set up Gmail with a third-party email client

    Google's IMAP and SMTP settings for Gmail in other clients: imap.gmail.com on port 993 with SSL, smtp.gmail.com on port 587 with TLS or port 465 with SSL, username is the full Gmail address. Since May 1, 2025, Google Workspace accounts no longer support apps that sign in with only a username and password; OAuth is required, and app passwords are for 2-Step Verification users whose client does not support OAuth.

    knowledge.workspace.google.com · 2026-10-15

  12. [12]
    Microsoft: POP, IMAP, and SMTP settings for Outlook.com

    Outlook.com settings: IMAP outlook.office365.com port 993 SSL/TLS, POP outlook.office365.com port 995 SSL/TLS, SMTP smtp-mail.outlook.com port 587 STARTTLS, all with OAuth2/Modern Auth. Username is your email address. POP and IMAP access is disabled by default: turn it on in Settings, Mail, Forwarding and IMAP, Let devices and apps use IMAP, Save. Outlook.com requires Modern Auth / OAuth2.

    support.microsoft.com · 2026-10-11

  13. [13]
    Microsoft: modern authentication now needed for Outlook.com in other apps

    Basic authentication stopped working for every Outlook.com account on September 16, 2024. Apps that connect over POP, IMAP, or SMTP must support modern authentication; Microsoft gives steps for Outlook, Thunderbird, and Apple Mail.

    support.microsoft.com · 2026-10-15

  14. [14]
    Microsoft Learn: send email from a device or application with Microsoft 365

    Client SMTP submission uses smtp.office365.com on port 587 (recommended) or 25 with TLS 1.2 or 1.3 and the mailbox's sign-in, limited to 10,000 recipients per day and 30 messages per minute. A device that defaults to port 465 does not support the required TLS. SMTP AUTH is disabled for organizations created after January 2020 but can be enabled per mailbox. Also covers SMTP relay and Direct Send on port 25.

    learn.microsoft.com · 2026-10-11

  15. [15]
    Yahoo Help: POP access settings and instructions for Yahoo Mail

    Yahoo Mail incoming POP server pop.mail.yahoo.com on port 995 with SSL. Outgoing server smtp.mail.yahoo.com on port 465 or 587, SSL required, TLS if available, authentication required with the full email address and a generated app password.

    help.yahoo.com · 2026-10-11

  16. [16]
    Apple Support: iCloud Mail server settings for other email apps

    iCloud Mail uses IMAP and SMTP and does not support POP. Manual settings are only needed when a device does not meet the iCloud system requirements. Incoming server imap.mail.me.com on port 993, SSL required (try TLS if SSL fails); the username is usually the name part of the iCloud Mail address (johnappleseed, not johnappleseed@icloud.com), or the full address if that fails; the password is an app-specific password. Outgoing server smtp.mail.me.com on port 587, SSL required (try TLS or STARTTLS if SSL fails), authentication required with the full iCloud Mail address and the same app-specific password.

    support.apple.com · 2026-10-15

  17. [17]
    Shipmail email client connection settings

    Shipmail IMAP, SMTP, and JMAP settings: mx1.shipmail.to, IMAP on port 993 with SSL/TLS, SMTP on port 465 with SSL/TLS or 587 with STARTTLS, the full email address as username, and the mailbox password or an app password.

    shipmail.to · 2026-10-15

  18. [18]
    Shipmail transactional email documentation

    Shipmail transactional email: an app sends from its own sending subdomain of a domain already verified in Shipmail, and replies go to a Shipmail mailbox. Sends count toward the plan's monthly quota, a sender costs nothing extra, Activity shows delivery status, and a retry with the same Idempotency-Key returns the first message. Every email from a sender carries its mailbox's address as Reply-To, so replies arrive in that mailbox's Transactional folder; the sending address itself cannot receive email. On a paid plan, an organization's transactional email starts at a safety limit of 1,000 recipients a day, raised daily to twice the highest clean day of the last 7 days, up to 25,000 automatically; the plan keeps 80% of its daily limit as a floor; a migration review with the last 30 days gets an answer within one business day.

    shipmail.to · 2026-11-09

  19. [19]
    Shipmail webhooks documentation

    Shipmail webhook events such as message.received, mailbox and domain scoping, signing, retries, and the optional Authorization header sent with each delivery.

    shipmail.to · 2026-10-15

Questions worth answering

Common questions about smtp port.

What is the SMTP port?
For sending from an email client or app, use port 587 with STARTTLS or port 465 with SSL/TLS. Port 25 is the original SMTP port, now used for mail servers relaying to each other.Sources[2]RFC 6409: Message Submission for Mail[3]RFC 8314: Cleartext considered obsolete, TLS for email[1]RFC 5321: Simple Mail Transfer Protocol
Should I use port 465 or 587?
Use whichever your provider lists. If it supports both, 465 encrypts from the start and is the one RFC 8314 prefers. 587 with STARTTLS is just as widely supported.Sources[3]RFC 8314: Cleartext considered obsolete, TLS for email[4]RFC 3207: SMTP service extension for secure SMTP over TLS
What is the difference between SSL and STARTTLS?
SSL/TLS on port 465 encrypts the connection as soon as it opens. STARTTLS on port 587 opens a plain connection and then upgrades it to TLS with a command. Both end up encrypted.Sources[3]RFC 8314: Cleartext considered obsolete, TLS for email[4]RFC 3207: SMTP service extension for secure SMTP over TLS
Why is port 25 blocked?
Port 25 accepts mail without a login, so infected machines can use it to send spam. AWS, Google Cloud, Azure and residential providers like Xfinity block it for outgoing mail and point you to port 587.Sources[5]AWS: Amazon EC2 restriction on email sent using port 25[6]Google Cloud: sending email from a Compute Engine instance[7]Microsoft Learn: troubleshoot outbound SMTP connectivity in Azure[8]Xfinity: why is port 25 for email submission not supported?
What is port 2525 used for?
It is an unofficial alternative that some sending services, such as SendGrid and Postmark, offer for networks that block 25 and 587. Use it only if your provider documents it.Sources[9]Twilio SendGrid: integrating with the SMTP API[10]Postmark: send email with SMTP
Does Gmail use port 465 or 587?
Both. smtp.gmail.com accepts port 465 with SSL and port 587 with TLS.[11]

Related guides

More on Shipmail pricing, comparisons, and team workflows.

Email, newsletters and booking pages on your own domain, in one plan.

Get started for free