What ports to open for a mail server?

Better Stack Team
Updated on November 23, 2023

To set up a mail server, you'll need to open specific ports to allow incoming and outgoing mail traffic. The ports you need to open depend on the email protocols you plan to use. The most common email protocols are SMTP (Simple Mail Transfer Protocol) for sending emails and IMAP (Internet Message Access Protocol) or POP3 (Post Office Protocol) for receiving emails. Here are the ports typically associated with these protocols:

  1. SMTP:
    • Port 25: This is the default port for SMTP. It's used for outgoing mail (sending emails).
  2. IMAP:
    • Port 143: This is the default port for IMAP, which is used for receiving emails. It's not secure and is typically used with STARTTLS or SSL/TLS encryption.
    • Port 993: This is the secure IMAP port, which is used when IMAPS (IMAP over SSL/TLS) encryption is employed.
  3. POP3:
    • Port 110: This is the default port for POP3, used for receiving emails without encryption.
    • Port 995: This is the secure POP3 port, used when POP3S (POP3 over SSL/TLS) encryption is employed.

Additionally, you may need to open other ports for services like SMTP submission (Port 587) for secure email submission by clients and secure email communication between mail servers (Port 465 for SMTPS).

Here's a summary of the commonly used email ports:

  • SMTP (Outgoing): Port 25, 587, or 465
  • IMAP (Incoming): Port 143 (with STARTTLS), Port 993 (with SSL/TLS)
  • POP3 (Incoming): Port 110 (without encryption), Port 995 (with SSL/TLS)

It's important to note that some email providers and organizations may use non-standard ports for security or other reasons, so you should consult the documentation for your specific mail server software for the most accurate information on which ports to configure.

Also, consider implementing proper security measures like encryption (SSL/TLS) and authentication to protect your mail server and the communications between your server and email clients.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github