This is an in-depth guide on incoming and outgoing mail servers.
You will get a complete idea of incoming and outgoing mail servers, how they work, and how to secure, configure, and troubleshoot them.
We’ve described each topic with practical use cases, detailed diagrams, and illustrations.
In this guide, you will explore step-by-step:
- What are incoming and outgoing mail servers?
- How do they work in small and large organizations?
- How to secure incoming and outgoing mail servers?
- What are server and client configurations?
- How to troubleshoot incoming and outgoing email issues?
Understanding incoming and outgoing mail servers in detail, with their designs, deployment and security configurations, will help you develop expertise in maintaining email services efficiently and troubleshoot issues quickly.
Contents
We have organized the article into six chapters. Each chapter focuses on specific aspects of incoming and outgoing mail servers.
Ready? Let’s dive in !!
Chapter1:
Incoming Mail Server
Now, let’s dive into the details of the Incoming Mail Server. We will start with the basics of incoming emails.
We will break down each topic step by step, using clear explanations, diagrams, and animations.
In this chapter, we will cover the lifecycle of incoming email, what an incoming mail server is, how it functions, and the differences between POP3 and IMAP.
We will also explore the advanced features of incoming mail servers and best practices for setting them up.
Let’s dive right in.
In this chapter, we are going to discuss the following:
- #1: What is Incoming Email?
- #2: What is Incoming Mail Server?
- #3: How Incoming Mail Servers Work?
- #4: POP3 vs IMAP: Which Should You Use?
- #5: Advanced Features of Incoming Mail Servers.
What is Incoming Email?
Incoming email refers to the process of delivering an email message from the sender to the recipient. Once the sender has composed and sent an email, it enters a series of steps before it reaches the recipient’s inbox.

The process of incoming email typically happens in two main stages:
- Stage 1: Email Traveling from the Internet to the Recipient’s Mail Server.
- Stage 2: Email Moving from the Incoming Mail Server to the Recipient’s Email Client.
For a short overview of the Incoming email flow please read here.
Incoming Email concept will be more clearer, if we had a better understanding of the lifecycle of incoming emails. It covers all the stages an email goes through from being sent to being delivered and accessed by the recipient.
The Lifecycle of an Incoming Email:
The lifecycle of an incoming email refers to the series of stages an email goes through, from the moment it is sent to when it reaches the recipient’s inbox.
It can travel a short path (direct delivery) or a long path (passing through multiple intermediate servers).
Short Path (Direct Delivery to Mailbox):
It’s a straightforward, minimal-step path where the email is sent from the sender’s server and directly delivered to the recipient’s mail server. The email is then retrieved by the recipient’s mail client.

Below are the steps, an Incoming email travels from the sender to the recipient:
- Step 1: User sends an email.
- Step 2: Email is received and processed by the sender’s outgoing mail server.
- Step 3: Sender’s mail server performs DNS lookup to find the recipient’s mail server.
- Step 4: Sender’s mail server send the Email directly to the recipient’s mail server.
- Step 5: Recipient Mail Server receives the Incoming mail and stores on User mailbox.
- Step 6: Recipient mail client retrieves the email from the Incoming mail server.
- Step 7: Email is delivered to the recipient’s inbox.
Long Path (Email Passing Through Multiple Servers):
In the long path scenario, the email may pass through multiple servers before it reaches the recipient’s mail server.
On the recipient side, the email infrastructure may include a load balancer, security gateway, email router, etc, or the mail may be processed at the ISP level first before being delivered to the user’s network. In these case, the email has to go through multiple servers.

- Step 1: User sends an email.
- Step 2: Email is received and processed by the sender’s outgoing mail server.
- Step 3: Sender’s mail server performs DNS lookup to find the recipient’s mail server.
- Step 4: Sender’s mail server send the Email to the recipient’s mail server.
- Step 5: Email passes through security and anti-spam checks.
- Step 6: Email may pass through relay servers for routing or load balancing.
- Step 7: Recipient Mail server Recieve and stores the email to user mailbox.
- Step 8: Mail client retrieves the email from the server using POP3 or IMAP.
- Step 9: Email is delivered to the recipient’s inbox.
In conclusion, The short path is a simple and quick email delivery, whereas the long path involves multiple hops, the email passes through various intermediate servers for essential routes and checks.

What is Incoming Mail Server?
An incoming mail server is the responsible server for receiving incoming email from the sender, store them on the user mailboxes and allow email clients (such as Outlook) to retrieve it using POP3/IMAP protocol.
For a short overview of the Incoming mail server please read here.
To elaborate on what an incoming mail server is and how it works, we need to understand its different designs and deployments in both small and large organizations:
Incoming mail server for Small Organization:
Scenario #1: (small business mail server)
In a small business environment, a standalone mail server is often used to handle all the organization’s email requirements.
This server manages incoming and outgoing emails, as well as storage and filtering, all on the same system. A single server to perform all these activities. Though, this design has both pros and cons, small businesses typically adopt this solution due to budget constraints.

Scenario #2: (dedicated incoming and outgoing server)
In some organizations, incoming and outgoing emails are handled with dedicated servers, that is even better and suggested for various reasons.
This setup breaks the single point of failure scenario, if one server goes down or becomes non functional, say, the IP is blocked due to being blacklisted, the other operation will still remain functional.
In this case, the outgoing server could be a lighter server with a minimal configuration, and the incoming server serves as the mailbox server with storage.

Scenario #3: (ISP provides incoming and outgoing services)
Some small organizations subscribe to ISP services for their inbound and outbound email filtering and relay. Most ISPs provide these types of services to their customers. The office mail server receives email from the ISP, and the server also sends email to the ISP server for final delivery to the recipient.
In this case, users may use their business mail server as both their incoming and outgoing server, or the ISP can provide direct outbound relay service for the user, allowing them to send email directly through the ISP.

Scenario #4: (cloud solutions)
In cloud mail services, the provider maintains the incoming and outgoing mail servers, and users need to configure their mail clients to use the service. If we deploy our own servers on the cloud, all three of the above scenarios will also be applicable.
Incoming mail server for Large Organization:
Scenario #1: (multiple incoming mail server)
In large organizations, redundancy is maintained in various aspects, including the incoming mail server.
It can be set up in failover mode, where if one server goes down, another will take over. Or, users can be separated across different servers, based on their priority.
Users must know which server to configure on their email client to download emails.

Scenario #2: (Load balancer, security gateway or email proxy)
For security and efficient email delivery, the incoming mail server can be placed behind an email security gateway or load balancer. An email proxy can also be deployed. In these cases, email clients may need to communicate with these intermediary appliances instead of directly connecting to the incoming mail server.
Enterprise email solutions often design their email systems in a more complex manner. Users may not be aware of the underlying architecture, but sometimes they receive training to understand how these systems behave.
For example, user interaction may be required to release emails that have been quarantined by security appliances, or email client configurations may need to support stronger authentication or encryption methods enforced by the email security gateway.

How Incoming Mail Servers Works
An incoming mail server has three main functions: receiving, storing, and delivering email. These functions are managed by three different mailing services within the server.

The MTA (Mail Transfer Agent) receives emails to the server, the MDA (Mail Delivery Agent) stores them in the mailbox, and the MRA (Mail Retrieval Agent) or POP3/IMAP services allow users to retrieve emails from the mailboxes.
Now, let’s talk about each of the components:
The Role of Mail Transfer Agents (MTA) in Receiving Emails:
When an incoming mail server receives an email, the MTA (Mail Transfer Agent) performs several key steps before passing the email to the next stage (usually the MDA). Here’s the detailed breakdown:
- Accepting the Connection: The MTA listens on port 25 and accepts SMTP connections from external servers. It starts an SMTP session to begin processing the incoming email.
- Validating the Sender and Recipient: It checks if the sender is legitimate and if the recipient address exists. Invalid addresses are rejected or bounced back to the sender.

- Applying Security and Policy Rules: The MTA may scan emails for spam, malware, or blacklisted sources. It can also enforce TLS encryption and verify SPF/DKIM/DMARC.
- Queueing the Message: Accepted emails are stored in a mail queue, for orderly processing and handling of delivery delays.
- Forwarding to the MDA: The MTA passes the email to the Mail Delivery Agent for final delivery. The MDA stores it in the user’s mailbox for retrieval via IMAP/POP3.
The Role of Mail Delivery Agents (MDA):
After MTA, email is handovered to Mail Delivery Agents (MDA). MDA or LDA (Local Delivery Agents) are responsible for storing emails in the recipient’s mailbox.
Key Functions of the Mail Delivery Agent:
- Receiving Emails from MTA: The MDA takes over after the MTA receives and verifies the email, preparing it for storage.
- Storing Emails: Emails are stored in the user’s mailbox, either in a file system (e.g., mbox, Maildir) or a database.
- File System: Emails are stored as individual files (Maildir) or in a single file (mbox).
- Database: Emails are stored in a database for better search and retrieval.

- Organizing Emails: The MDA can sort emails into folders like “Inbox,” “Spam,” or “Sent” based on rules or user preferences.
- Managing Mailbox Limits: The MDA handles mailbox quotas, preventing new mail delivery if storage limits are exceeded until space is cleared.
- Mailbox Notifications: Users receive notifications when new mail arrives, either via alerts, push notifications, or email client refreshes.
The Role of POP3/IMAP Services Or, Mail Retrieval Agents (MRA):
Mail Retrieval Agents (MRA) allows users to access and manage emails that are stored in their mailboxes. The two primary protocols used for email retrieval are POP3 (Post Office Protocol 3) and IMAP (Internet Message Access Protocol).
Both protocols allow users to retrieve their emails, but they function differently.

- POP3 (Post Office Protocol 3): POP3 enables users to download emails from their mailbox to a local device. Once emails are downloaded, they are deleted from the server. POP3 is ideal for users who prefer accessing their emails from a single device and want to store emails locally for offline access.
- IMAP (Internet Message Access Protocol): IMAP allows users to access their emails on the server. This protocol supports email synchronization across multiple devices, ensuring emails, folders, and actions (like deleting or flagging messages) are consistent across all platforms. IMAP is ideal for users who access their email from multiple devices and need to keep their inbox consistent on all devices.
For a detail overview of email protocols and how they work?, you can read this section of Email server definitive Guide.
POP3 vs IMAP: Which Should You Use?
Now, let’s break down how POP3 and IMAP compare in real world usage. The table below shows the key differences in features, strengths, and best use cases, so that, you can easily choose the right protocol you need.
Feature / Use Case | POP3 | IMAP |
---|---|---|
Email Storage | Downloads to device, usually deleted from server | Stored on server, accessible from anywhere |
Sync Across Devices | ❌ Not supported | ✅ Real-time synchronization |
Offline Access | ✅ Full offline access to downloaded emails | ⚠️ Partial (cached content only) |
Server Storage Usage | Low (frees up server space) | High (emails stored on server) |
Speed | Faster (downloads once) | May be slower (constant sync) |
Access from Multiple Devices | ❌ Not practical | ✅ Fully supported |
Email Backup & Recovery | Risk of loss if device fails | Safer, stored and backed up on server |
Organization (Folders/Labels) | ❌ Not supported | ✅ Supports folders, tags, labels |
Best For | • Single-device users • Limited server space • Offline access | • Business users • Access from multiple devices • Team collaboration |
Common Use Cases | Home users, Solo professionals, travellers | Work email, mobile users, remote teams |
✅ Quick Takeaway: Which One Should You Use?
User Type | Recommended Protocol |
---|---|
Single-device/home user | POP3 |
Low internet connectivity | POP3 |
Business or remote workers | IMAP |
Access email on phone + PC | IMAP |
Need email backup & sync | IMAP |
💡 Tip: Many modern email providers support both POP3 and IMAP, so you can start with POP3 and migrate to IMAP later when you need.
Advanced Features of Incoming Mail Server
Incoming mail server often configured with the advanced fetures, it will enhance email security and reliability. Below, we listed some of the key advanced features:
- Spam and Malware Filtering: Incoming mail servers often implement advanced spam filters and anti-virus scanners to detect and block unwanted emails, including phishing attempts, malware, and promotional content. Anti-malware scanners analyze attachments and embedded links to identify and block potential threats.
- TLS Encryption: TLS encryption ensures secure communication between email client and Incoming mail server. TLS prevents unauthorized access to sensitive information during transmission. we will discuss about this in detail in later section.
- Redundancy and Failover: To ensure uninterrupted service, incoming mail servers often configured with redundant servers. If one server gets down, another will take over, it ensures zero downtime for email delivery.
- Mailbox Quota Management: Incoming mail servers provides email storage quota management. It prevents overloading the mailboxes. quota alerts helps to keep the storage clean for new messages.
- Auto-Discovery and Configuration: Modern incoming mail servers support Auto-Discovery, which allows email clients like Outlook or Thunderbird to automatically configure their settings without requiring manual setup from the user.
- Advanced Logging and Monitoring: Incoming mail servers provide detailed logs of email delivery and retrieval. Administrators can monitor email traffic, identify bottlenecks, or troubleshoot delivery issues.
- Inbound Relay and Routing: Incoming mail server can employ advanced routing policies, to route incoming emails to different servers based on domain or user.
Some of the advanced features are built in to the mail server software, some are depends on the design and deployment of the incoming mail server, we can employ based on our needs.
✅ Key Takeaways: Incoming Mail Server
- Incoming mail servers receive emails and deliver them to user mailboxes.
- They use POP3 and IMAP protocols to allow email clients to access stored emails.
- Email can travel via a short path (direct delivery) or a long path (through multiple servers).
- POP3 is ideal for single-device offline access; IMAP is better for multi-device syncing.
- Components like MTAandMDAmanage receiving and storing emails.
- Advanced incoming server features include spam filtering, encryption, and auto-discovery.
Chapter2:
Outgoing Mail Server
Now, we will dive into the details of outgoing mail server. We will start with the basics of the outgoing email.
We explained each concepts in detail with illustrations, diagrams and animations.
In this chapter, we will cover the lifecycle of outgoing email, what an outgoing mail server is, how it works, protocol, authentication and encryptions it uses.
We will also discuss the advanced features and key difference between the incoming and outgoing mail server.
Let’s dive right in.
In this chapter, we are going to discuss the following:
- #1: What is Outgoing Email?
- #2: What is Outgoing Mail Server?
- #3: How Outgoing Mail Servers Work?
- #4: Advanced Features of Outgoing Mail Server.
- #5: Key differences Between Incoming and Outgoing Mail Server.
What is Outgoing Email?
Outgoing email refers to the process, where an email message is sent from the sender to the recipient. After the sender composes an email and clicks “send,” the email is sent out of the sender’s email system and travels towards the recipient email system.

The process of outgoing email also happens in two main stages:
- Stage 1: Email sent from the sender to sender’s Outgoing Mail Server.
- Stage 2: Email travel from the sender’s server to the Recipient’s Incoming Mail Server.
For a brief overview of the outgoing email flow please read here.
The concept of outgoing email will be more clearer if we can understand the lifecycle of outgoing emails. which describes all the stages an outgoing email takes before it reaches to the recipient mail server.
The Lifecycle of an Outgoing Email:
Like the incoming email (we described earlier) the outgoing email also goes through some series of stages before it reaches to the recipient mail server. and the path it takes can also be a short path (direct send) or a long path (sending through multiple email gateways).
Short Path (direct send):
The idea of direct email delivery or short path for an outgoing email is same as the incoming email, both sender and recipient mail server finds each other to send email directly. we already cover the concept earlier.
Long Path (sending through multiple email gateways):
In large organization, or when an ISP provides intermediary email services, outgoing emails may travel towards the recipient’s server after being processed by multiple email gateways or SMTP gateways. This mostly happens for email routing and security checks.

Typical email flow could be like the following steps:
- Step 1: User sends an email.
- Step 2: Email is received and processed by the outgoing mail server.
- Step 3: Outgoing mail server forwards the emails to the email router or load balancer.
- Step 4: Email router checks the routing policy and handover it to email Security gateway
- Step 5: Email Gateway performs the anti-spam check and find the recipient mail server.
- Step 6: Email Security Gateway delivers the email to the recipient mail exchanger.
the outgoing emails’ journey ends on reaching the first contact mail server for the recipient domain. rest of the steps will be considered as the incoming steps for the recipient.
What is Outgoing mail Server?
An outgoing mail server is the server responsible for sending email to the recipient. when a user sends an email, the outgoing mail server receives the email and forwards it to the recipient’s mail server.

The outgoing mail server works with the SMTP protocol to communicate with other mail servers. It listens on port 25, 465, or 587 to accept connections. Before relaying the outbound email, it authenticates the mail clients and optionally uses encryption to secure the data.
Types of Outgoing Mail Servers:
Based on the business and email sending patterns, outgoing mail servers can be categorized into two types:
- Bulk Email Server: These are specialized mail servers, lightweight and fast, designed for high volume email sending. mainly used for bulk email campaigns in email marketing.
- Transactional Email Server: These are general email systems used for everyday email communication.
ℹ️ Note: In this article, we will talk about the outgoing mail server for transactional emails, we will try to cover the bulk email server on another post.
Outgoing mail server for Small Organization:
Scenario #1: (Small Business Mail Server)
In a small business environment, there is typically no separate infrastructure for handling outgoing mail. Both incoming and outgoing emails are handled by the same server. Users must configure their email clients to use this server to send and receive emails.
These servers are utilized to their full capacity, incoming, outgoing, mail storage, webmail all functionalities are provided by the same server. They also provide basic email filtering capabilities for inbound and outbound emails.

Scenario #2: (Dedicated Outgoing Mail Server)
Small businesses sometimes deploy a dedicated outgoing mail server, which is designed to handle only outbound emails. In this case, users’ incoming and outgoing mail configurations will be different.
Separating inbound traffic from the outgoing server improves performance and security. Dedicated spam and virus filtering can work more effectively for outbound emails. Isolating the incoming email from the outgoing server also reduces the risk of being blacklisted.

Scenario #3: (ISP Gateway as Outgoing Mail Server)
For better security and deliverability, small organizations sometimes use ISP email gateway services.
In this case, outgoing emails are rerouted to the ISP gateway for security checks and final delivery. Clients can still use the same internal server as their outgoing mail server, or the ISP gateway can be used directly if they allow user level relay.
However, most of the time, they provide relay permission only to the organization’s outgoing mail servers.

Outgoing mail server for Large Organization:
Scenario #1: (Email Security Gateway as Outgoing Mail Server)
Organizations can deploy email security gateways for email filtering and control outgoing emails. In this case, users may use the security gateway as their outgoing mail server.
However, most of the time, the internal mail server functions as the outgoing mail server and forwards all outgoing emails to the email security gateway.

Scenario #2: (Load Balancer/Proxy as Outgoing Mail Server)
Organizations can deploy an email load balancer to load balance outgoing emails. The load balancer can be deployed as the first contact mail server for the user, before the in-house server. In this case, users must configure their mail clients to use the load balancer as their outgoing mail server.
If the load balancer is deployed after the internal server, it will relay and load balance outbound emails after receiving emails from the internal server. In this case, users will continue to use the internal server as their outgoing mail server.

In summary, outgoing mail server configuration can vary based on the organization’s system design and planning. Users must follow the organization’s outbound email policy and configure their mail clients accordingly.
How Outgoing Mail Server Work?
An outgoing mail server has two main functions: receiving emails and delivering them to the recipient’s server. These two functions may be handled by dedicated mailing services or a single service, depending on the mail server software implementation.

When a user sends an email, the email client connects to the outgoing mail server’s MTA (Mail Transfer Agent). The MTA listens on ports 25, 465, and 587 to accept connections from email clients. The MTA receives the email and places it in the queue for delivery. It then finds and connects to the recipient’s server to deliver the email.
How the mail services work for outgoing email?
When a client sends an email to the outgoing mail server, and the server delivers it to the recipient’s server, the SMTP protocol is used. Port 25 is the standard port for the SMTP protocol.
After receiving the email from the client, it is immediately placed in the mail queue for further delivery. The remote delivery agent (MDA) then starts a remote session with the recipient’s mail server using the SMTP protocol to deliver the email.
This receive and send operation may be handled by the same system component, or it can be different components, which depends on the mail server software implementation.

When SSL/TLS security is enabled on the server, ports 587 or 465 become active. The client must communicate with these secured ports to submit emails to the outgoing server. These ports are handled separately with different services (submission) inside the mail server.
In this case, port 25 is used to connect to the remote mail server to deliver emails. This operation is handled separately by another service, the Remote Delivery Agent.

How SMTP protocol is used?
SMTP (Simple Mail Transfer Protocol) is the de facto standard protocol for email servers to communicate with each other. Where mail clients receive emails using POP3/IMAP and send using SMTP.
So, SMTP is used when the client sends an email to the outgoing mail server, and the outgoing mail server uses SMTP to send the email to the recipient’s server.

SMTP protocol is essentially a set of commands and data transmissions used to send and receive emails between email systems. Mail Server softwares implements various checks and filters based on the SMTP protocol conversations.
How SMTP Authentication is used?
Users must have permission to send emails to external recipients. Sending emails to local users may not require such permissions, but when the outgoing mail server relays an email to an external server, it must confirm that the users are authorized to do so.

Relay restrictions can also be applied to the entire network or individual IP addresses.
If the outgoing mail service is provided by the ISP, they can even enforce authentication for the sending server as well.
How SMTP Encryption works?
The outgoing mail server can be configured to accept only encrypted connections. It can listen on port 465 for SSL connections and port 587 for TLS connections.
Normally, these encryptions are enforced when the email client tries to connect to the outgoing mail server to send an email.

The outgoing mail server can be configured to use SSL/TLS to communicate with other mail servers, in that case, both party must be configured to work on SSL/TLS sessions.
Advanced Features of Outgoing Mail Server
Outgoing mail servers are often configured with the advanced features to enhance email security and deliverability. Below, we have listed some of the key advanced features:
- Outbound Spam Filtering: Outgoing mail servers can integrate spam filtering systems to prevent legitimate users from sending spam unintentionally. Local users may send emails through malware-infected systems, which could cause IP blacklisting.
- SMTP Authentication: Outgoing mail servers implement SMTP authentication to verify sender identities before processing emails. This prevents unauthorized users from sending messages and protects against email spoofing. Supported methods include PLAIN, LOGIN, CRAM-MD5, and OAuth2 for secure authentication.
- DKIM/SPF/DMARC: Outgoing mail servers employ these authentication protocols to verify email legitimacy. DKIM adds digital signatures, SPF specifies authorized sending servers, and DMARC defines handling policies. Together, they prevent domain spoofing and improve deliverability.
- TLS Encryption: Outgoing mail servers may enforce TLS encryption to secure email transmission between email clients and servers. Mandatory TLS ensures messages cannot be intercepted in transit.
- Rate Limiting: Outgoing mail servers implement smart rate controls to prevent abuse. They limit emails sent per user/IP address within specific timeframes.
- Smart Host Routing: Enterprise configurations use backup servers for failover protection. If the primary server fails, emails are automatically routed through secondary systems.
- Load Balancing Outbound Mail: Outgoing mail servers can be part of a distributed architecture, where multiple servers handle email delivery. Load balancing algorithms ensure that outgoing email traffic is evenly distributed across multiple servers, preventing any single server from becoming a bottleneck.
- Archiving for Compliance: Outgoing mail servers can be configured to automatically archive outgoing emails for auditing, which is required for regulatory compliance.
- Advanced Logging: Comprehensive logging tracks all outgoing email activity. Administrators can monitor delivery status, identify bottlenecks, and generate detailed reports. This is required for quick troubleshooting of any delivery issues.
All the features above are not available to all mail server software. Sometimes, custom configurations and setup are necessary to enable the advanced features.
Key Differences Between Incoming and Outgoing Mail Server:
⚙️ Feature | 📥 Incoming Mail Server | 📤 Outgoing Mail Server |
---|---|---|
Direction of Communication | Incoming (receive emails) | Outgoing (send emails) |
Purpose | Receive emails from the sender’s mail server and deliver them to the recipient’s. | Send emails from the sender’s email client to the recipient’s mail server. |
Common Protocols | POP3 (Post Office Protocol 3), IMAP (Internet Message Access Protocol) | SMTP (Simple Mail Transfer Protocol) |
Port Numbers | POP3: 110 (non-secure), 995 (secure via SSL/TLS) IMAP: 143 (non-secure), 993 (secure via SSL/TLS) | SMTP: 25 (non-secure), 587 (secure via TLS), 465 (secure via SSL) |
Email Encryption | Supports SSL/TLS encryption for secure communication. | Supports SSL/TLS encryption for secure communication. |
Authentication | Requires user authentication (username/password) for email retrieval. | Requires SMTP authentication to send emails. |
✅ Key Takeaways: Outgoing Mail Server
- Outgoing mail servers send emails from users to recipient servers via the SMTP protocol.
- Emails can take a direct route or pass through multiple security gateways before delivery.
- SMTP servers require authentication and often enforce encryption using SSL/TLS.
- Dedicated outgoing servers improve email delivery, reliability, and reduce spam risks.
- Outgoing mail servers operate on ports 25, 465, or 587, depending on encryption settings.
- Advanced features include spam filtering, rate limiting, DKIM signing, and smart host routing.
Chapter3:
Mail Server Security
Now, we will talk about Incoming and Outgoing mail server security. We will explain how an email pass through the security layers of incoming and outgoing mail servers.
We explained the concepts in detail, with illustrations, diagrams and animations.
In this chapter, I will describe how email protocol security works, including the security considerations for POP3, IMAP, and SMTP, and how they function.
I will also talk about What are SPF, DKIM and DMARC and how they work.
Let’s dive right in.
In this chapter, we are going to discuss the following:
What is Incoming Mail Server Security?
The incoming mail server is the first layer defense to protect incoming emails from spam and malware.
When an email is received by the incoming mail server, it passes through several components, such as the MTA, MDA, and MRA (POP3/IMAP), before reaching the recipient’s mail client. Each of these components applies security checks to ensure the email is safe and legitimate.

What are MTA level Filtering?
When MTA starts communicating with the sending MTA, before it receives email, it applies the following security steps:
- MTA applies connection level filtering, it can allow or deny SMTP connections based on source and destination IP and domain.
- It checks the sender mail server ip, it is permitted to send for the sender domain through the SPF, DKIM and DMARC record from the DNS.
- It checks the email header, body and find the spam like content to identify the email is legitimate or spam.
- advanced anti malware and virus check has been done by the advanced filters, integrated to MTA component.
After the MTA checks, emails are placed on the Mail queue for further processing by the MDA.
What are MDA (Mail Delivery Agent) level Filtering?
MDA (Mail Delivery Agent) takes the email from the Mail Queue and applies the following security checks before delivery to mailbox:
- It applies filtering rules by checking predefined MDA configuration script, matching emails based on headers (From/To/Subject), body content (keywords/patterns), attachments (file types/sizes) etc.
- It then executes actions like delivering to specific folders (Inbox/Work), forwarding, discarding spam, piping to scripts, or tag messages to deal with other email programs.
Finally, after all these checks and actions, It delivers the email to the user’s mailbox.
What are MRA (Mail Retrieval Agent) level Security?
After the email is received by the MTA and MDA, it is placed in the mailbox. Before it is placed in the mailbox, all sorts of content security checks are performed.
Now, when it’s time for the user to retrieve the email from the incoming mail server, the MRA works with the POP3/IMAP protocols to securely deliver the email to the email clients.
Now, Let’s discuss:
- What is POP3 Security?
- What is IMAP Security?
What is POP3 Security?
POP3 (Post Office Protocol v3) is an unencrypted, plain text email protocol to download messages. Normally, it transmits data plaintext without any security.
To secure POP3 communications, encryption methods such as POP3S (POP3 over SSL/TLS on port 995) are employed, which encrypts the entire session. If we use STARTTLS (instead of SSL/TLS) it will upgrade plaintext POP3 connection on port 110 to a secure TLS connection on port 995.

For user authentication, MRA’s rely on secure methods such as SASL (Simple Authentication and Security Layer), which supports mechanisms like: PLAIN, LOGIN, or CRAM-MD5 and OAuth2 (used by cloud services like Gmail/Outlook for token-based auth). These mechanisms prevent credential theft during transmission.
What is IMAP Security?
IMAP (Internet Message Access Protocol) is also another unencrypted, plain text protocol, which synchronizes clients with the server without encryption. by default, it transmits data in plain text.
To secure IMAP communications, encryption methods like IMAPS (IMAP over SSL/TLS on port 993) are commonly used, which ensures the entire connection is encrypted from the start. Alternatively, STARTTLS can be used to upgrade plaintext IMAP communication on port 143 to a secure TLS connection.

For user authentication, IMAP relies on secure methods such as SASL (Simple Authentication and Security Layer), supporting mechanisms like SCRAM-SHA-256 and OAUTHBEARER, as well as OAuth2, which is commonly used by modern email services like Exchange and Gmail for token-based authentication. These mechanisms protect users from credential theft during transmission.
What is Outgoing Mail Server Security?
Before email delivery, the outgoing mail server applies various security checks on the outbound email to ensure emails are clean and malware free. Below are the key steps performed by the outgoing mail server, to secure the outgoing emails:
- At first, the outgoing mail server establishes a secure TLS connection with the mail client to receive emails and to further communicate with it securely.
- Then, the server performs SMTP connection level filtering. It checks the source IP and domain of the client to ensure, the sender’s IP and domain are allowed to send emails.

- The outgoing mail server enforces SMTP authentication. It requires users to authenticate themselves using a username and password in order to get authorized to send emails through the server, this is called relay permission.
- The server adds a DKIM (DomainKeys Identified Mail) header to the email, which allows the recipient’s mail server to verify that the email’s content has not been tampered with during transit.
- Advanced spam and malware filters are applied to scan the email’s content, ensuring that it does not contain malicious attachments, code, or links.
- Finally, the outgoing mail server performs outbound SMTP connection filtering during communication with the recipient mail server. If the recipient server’s IP is blacklisted or known to be a spam source, the email may not be delivered.
These steps collectively protect both the user and the outgoing server. Without proper security checks, emails can be flagged as spam, and the server’s IP can get blacklisted.
What is SMTP Security?
SMTP Security refers to the practices and protocols used to secure the SMTP transmission. During incoming and outgoing email delivery, maintaining a secured transmission is very important.
Various protocols and techniques like SMTP Authentication (SMTP AUTH ), SMTP over SSL/TLS, SPF, DKIM, DMARC, Reverse DNS etc, are involved to secure the SMTP transmission. with these, SMTP connection level security measures are important to maintain the secure transmission.
SMTP Connection Level security:
Mail server softwares implements SMTP connection level security, during the SMTP protocol handshake, mail servers applies security mechanism to prevent communication with the spam sources.
SMTP commands and probable security measures on each command, are listed below:
- HELO/EHLO Command (Initial Greeting): The HELO/EHLO command starts the SMTP session and introduces the sending server to the receiver.
- SMTP Authentication (AUTH) can be enforced to ensure only authorized senders can use the server.
- Reverse DNS Lookup helps verify that the sending server’s IP address is legitimate, reducing the chances of connecting with spam sources.
- MAIL FROM Command (Sender Address): This command specifies the sender’s email address.
- SPF (Sender Policy Framework) verifies that the sending server is authorized to send mail on behalf of the sender’s domain.
- SMTP AUTH can be used to authenticate the sender, preventing email address spoofing.

- RCPT TO Command (Recipient Address): The RCPT TO command specifies the recipient’s email.
- SPF checks to ensure the sending server is authorized to send mail to the recipient’s domain.
- Graylisting/Blacklisting helps block or delay mail from known spam sources, and rate limiting prevents abuse by limiting the number of recipients per session.
- DATA Command (Message Content): The DATA command signals the start of the message content.
- TLS/SSL Encryption ensures that the message content is encrypted, preventing eavesdropping.
- DKIM (DomainKeys Identified Mail) signs the email content, ensuring the integrity and authenticity of the message.
- QUIT Command (End of Session): The QUIT command ends the SMTP session.
- Session Logging records the session’s details for auditing, helping detect any unusual or malicious activities.
- Session Timeout limits idle sessions, minimizing the risk of unauthorized access.
Applying security during SMTP connection is a great advantage, it provides early protection, before email enters the incoming system and before email delivery.
SMTP Secure Channel vs End-to-End Encryption:
We already discussed about how SSL/TLS are used to create the SMTP secure channel between the client and server, and also between two servers.
Server to server TLS encryption is not a general practice, it could happen between two communicating parties upon agreement on both sides.

But, there is a catch, as the server to server TLS encryption are not possible all the time, email remains unencrypted during transferring from one server to another.
That is a huge security issue for confidential data, though the email was encrypted when client sent email to outgoing server and also receive email from incoming server.
And the solution for this, is the end-to-end encrypted email.
What is End-to-End Encryption?
End-to-end encryption (E2EE) for emails is a method of encrypting email messages so that only the intended sender and recipient can read the content. This ensures that even if someone intercepts the email during transmission, they will not be able to decrypt and read it without the correct decryption key.

How it works:
- Encryption at Sender’s Side: When the sender sends an email, the content is encrypted using a public key encryption system (like PGP or S/MIME). The sender uses the recipient’s public key to encrypt the message.
- Transmission: The email travels through the internet, passes various servers and networks, but it remains encrypted.
- Decryption at Recipient’s Side: The recipient uses their private key to decrypt the email and read its content. Only the recipient’s private key can decrypt the message, ensuring confidentiality.
Because the email is encrypted, and only the recipient can decrypt it, no one, including email service providers, can decrypt the message, which provides the utmost security.
SPF, DKIM, and DMARC Overview
What is SPF (Sender Policy Framework)?
SPF is an email authentication protocol designed to help detect and prevent email spoofing. It allows domain owners to define which mail servers are authorized to send emails on behalf of their domain.
When the Sending Server Uses It: The domain owner publishes an SPF record in their DNS settings. This record lists the authorized IP addresses or mail servers that are allowed to send email for that domain.
When the Receiving Server Uses It: When the receiving mail server gets an email, it checks the “From” domain in the email’s header. The recipient’s server then queries the domain’s DNS for the SPF record associated with that domain.
- If the sending server’s IP address matches an IP address in the domain’s SPF record, the email passes the SPF check.
- If there is no match, the email fails the SPF check and could be flagged as spam or rejected, depending on the receiving server’s policy settings.
What is DKIM (DomainKey Identified Mail)?
DKIM is another email authentication method that uses cryptographic techniques to ensure the integrity and authenticity of email messages. It involves signing the email with a private key to prove, it was sent by the domain owner and hasn’t been altered in transit.
When the Sending Server Uses It:
- The sending mail server generates a unique digital signature for the email by hashing parts of the email (like the body and certain headers) and encrypting it with a private key.
- This signature is added to the email’s headers as a DKIM-Signature header.
- The public key needed to verify the signature is published in the domain’s DNS records.
When the Receiving Server Uses It:
- Upon receiving the email, the recipient’s mail server uses the domain’s public DKIM key (retrieved from DNS) to verify the signature in the email header.
- If the public key matches the hash in the email, it proves the email was sent by the legitimate sender, it wasn’t altered in transit.
- If the DKIM check fails, the email may be flagged as potentially fraudulent.
What is DMARC (Domain-based Message Authentication, Reporting, and Conformance):
DMARC builds on SPF and DKIM by specifying what actions the receiving server should take if an email fails SPF or DKIM checks. It also provides a mechanism for domain owners to receive reports about email authentication activity for their domain.
When the Sending Server Uses It:
- The sending server itself does not “use” DMARC directly, domain owner publishes DMARC record in the DNS. The DMARC policy specifies how email receivers should handle emails that fail SPF or DKIM checks.
When the Receiving Server Uses It:
- Upon receiving an email, the recipient’s mail server checks for a DMARC record in DNS for the sending domain.
- It verifies if the email has passed SPF or DKIM checks (or both). If neither SPF nor DKIM passes, the DMARC policy dictates how to handle the email (e.g., reject, quarantine, or allow it).
- The receiving server also sends feedback reports to the domain owner about the email’s authentication results, which can help the domain owner monitor and improve their email security practices.
In summary, to ensure the security of both incoming and outgoing mail servers, various layers of protection are applied, including filtering at the MTA, MDA, and MRA levels.
Communications are encrypted with SSL/TLS for key protocols like POP3, IMAP, and SMTP. SPF, DKIM, and DMARC play a crucial role in authenticating emails and preventing spam and malware, and end-to-end encryption further secures communications.
🔐 Key Takeaways: Mail Server Security
- Incoming servers use POP3/IMAP security with SSL/TLS encryption to protect data in transit.
- Outgoing servers secure SMTP connections using authentication, encryption, and domain verification protocols.
- MTA-level filtering scans incoming emails for spam, malware, and spoofing attempts before delivery.
- Security layers like SPF, DKIM, and DMARC help validate email authenticity and prevent domain spoofing.
- End-to-end encryption (E2EE) ensures that only the intended recipient can read email content.
- Connection-level SMTP security practices include reverse DNS lookup, TLS enforcement, and greylisting.
Chapter4:
Server Settings
Now, in this chapter, we will show you some practical server settings and how they are configured.
We have discussed server setups and how incoming and outgoing mail servers are deployed to provide services to clients.
In this section, I will provide the incoming and outgoing server settings from various major providers, including the associated ports and security configurations.
We’ve presented the details in a table format for easy understanding and follow-through.
Let’s dive right in.
In this chapter, we are going to configure few mail clients:
Server Configuration Settings:
So, what are the incoming and outgoing mail server configurations? As shown in the design and diagrams earlier, servers can be set up in different ways across various organizations, but the settings for the clients typically remain the same.

We need to understand the mandatory server configuration parameters required to communicate with the servers to send and receive emails.
- Server/Host/Hostname: This is the actual server we need to communicate with, whether it’s the outgoing or incoming server. It’s identified by the server’s hostname or IP address. In most cases, we use the server hostname, but we can also communicate by specifying the IP address.
- Ports: Incoming and outgoing mail servers are configured with specific ports to communicate with clients and other servers. We discussed the relevant ports earlier. The server provider will provide the necessary port numbers to configure the clients, and the local firewall must be configured to allow communication through those ports.
- Encryption: Nowadays, most providers accept only SSL/TLS secure channels for inbound and outbound connections for security reasons. In such cases, different ports are used (as mentioned earlier), and data is transmitted in encrypted form.
- Authentication: The server needs to authenticate clients before they can send or receive emails. Users must be permitted to do so. Basic authentication involves the account username and password, but the server may require a different password than the account password or other authentication methods, such as 2FA or OAuth2.
These are the most common settings required to communicate with incoming and outgoing mail servers. However, one important thing to note is that the ports are not always fixed. Providers may use different ports, and in that case, they will publish the port information for configuration.
Example Configurations
Below, we have provided the incoming and outgoing server configurations for a few renowned email service and hosting providers (Gmail, Yahoo, Outlook.com, Zoho, and GoDaddy) as examples.
#1: Gmail Configuration
Setting | POP3 📥 | IMAP 📨 | SMTP 📤 |
---|---|---|---|
Host | pop.gmail.com | imap.gmail.com | smtp.gmail.com |
Port | 995 | 993 | 587 |
Encryption | TLS (ON) | SSL | TLS |
Username | (Your Gmail username) | (Your Gmail username) | (Your Gmail username) |
Password | (Google App Password) | (Google App Password) | (Google App Password) |
#2: Yahoo Configuration
Setting | POP3 📥 | IMAP 📨 | SMTP 📤 |
---|---|---|---|
Host | pop.mail.yahoo.com | imap.mail.yahoo.com | smtp.mail.yahoo.com |
Port | 995 | 993 | 465 or 587 |
Encryption | SSL (Required) | SSL (Required) | SSL/TLS |
Authentication | Yes | Yes | Yes |
Username | (Your full email address) | (Your full email address) | (Your Yahoo username) |
Password | (Generate App Password) | (Generate App Password) | (Generate App Password) |
#3: Outlook.com Configuration
Setting | POP3 📥 | IMAP 📨 | SMTP 📤 |
---|---|---|---|
Server | outlook.office365.com | outlook.office365.com | smtp-mail.outlook.com |
Port | 995 | 993 | 587 |
Encryption | SSL/TLS | SSL/TLS | STARTTLS |
Authentication | OAuth2/Modern Auth | OAuth2/Modern Auth | OAuth2/Modern Auth |
Username | (Your email address) | (Your email address) | (Your email address) |
Password | (Your Microsoft account password) | (Your Microsoft account password) | (Your Microsoft account password) |
you can check additional requirements from here.
#4: Zoho Configuration
Setting | POP3 📥 | IMAP 📨 | SMTP 📤 |
---|---|---|---|
Host | pop.zoho.com | imap.zoho.com | smtp.zoho.com |
Port | 995 | 993 | 465 or 587 |
Encryption | SSL | SSL | SSL (Port 465) TLS (Port 587) |
Username | (your Zoho email address) | (your Zoho email address) | (your Zoho email address) |
Password | (your Zoho email password) | (your Zoho email password) | (your Zoho email password) |
#5: Godaddy Configuration
Setting | POP3 📥 | IMAP 📨 | SMTP 📤 |
---|---|---|---|
Server | pop.secureserver.net | imap.secureserver.net | smtpout.secureserver.net |
Port | 995 | 993 | 465 or 587 |
Security | SSL (Required) | SSL/TLS | SSL/TLS |
Authentication | Yes | Yes | Yes |
Username | (Your full email address) | (Your full email address) | (Your full email address) |
Password | (Your GoDaddy password) | (Your GoDaddy password) | (Your GoDaddy password) |
These are the common settings we have provided. Providers may update their server configurations, ports, or security protocols over time. If the configuration doesn’t work, please check the provider’s official page for the most up-to-date information.
⚙️ Key Takeaways: Server Configurations
- Correct server setup requires hostname, port numbers, encryption methods, and authentication settings.
- Common incoming ports include 110 (POP3), 995 (POP3 SSL), 143 (IMAP), and 993 (IMAP SSL).
- Common outgoing ports include 25 (SMTP), 465 (SMTP SSL), and 587 (SMTP TLS).
- Most providers enforce SSL/TLS encryption for both incoming and outgoing email communications.
- Email client settings depend on the provider’s server hostname, port configuration, and authentication method.
Chapter5:
Client Configurations
Now, we will show you some practical implementations based on what we’ve discussed so far. On the server side, there could be various network design considerations, but for the end user, the mail configuration remains the same.
We will explain this with the necessary screenshots and step-by-step instructions.
In this chapter, I will configure Microsoft Outlook and Mozilla Thunderbird, and walk you through the details of incoming and outgoing server configurations, including security settings, ports, and SMTP authentication.
Let’s dive right in.
In this chapter, we are going to configure few mail clients:
Microsoft Outlook Configuration
Now, we will configure Microsoft Outlook. I will show you how to properly setup the Incoming and Outgoing mail server with ports and SMTP Auth settings.
1. Go to Windows -> Control Panel -> Mail (Microsoft Outlook)
It will open the dialog box to create Mail Profile, Click Add Button, On the New Profile Window provide the Profile Name, then click OK, It will open the Add Account dialog box.

2. Choose “Manual setup or additional server types” Click Next

3. Select “POP or IMAP”, Click Next, It will Open “POP and IMAP Account Settings” dialog box.

4. Please follow the screenshot and Provide the below Information correctly to setup the email account.
User Information
Your Name: [Your Display Name]
Email Address: [your email address]
Server Information
Account Type: [Select POP or IMAP]
Incoming mail server: [Provide the Incoming mail server IP or Hostname]
Outgoing mail server: [Provide the Outgoing mail server IP or Hostname]
Logon Information
User Name: [Full email address or email id]
Password: [Password of your account]

Now, Click on the “More Settings” Button, it will open the “Internet Email Settings” dialog box.
Click on the “Outgoing Server” tab and select the checkbox “My outgoing server (SMTP) require authentication” and select the radio button “Use same settings as my Incoming mail server”
if your admin provide different user/pass for SMTP Authentication then, select the “Log on using” the provide your SMTP user/pass.
5. Now, Click on the “Advanced” tab and provide “Incoming server (POP3)” and “Outgoing server (SMTP)” Port and SSL/TLS settings.
Now, Click “OK” to close the dialog box and Click Next on the “POP and IMAP account Settings”

6. Now, it will test account Settings and shows the Test results. Click “Close”.

7. Now, Account Setup is Finished, Click the “Finish” Button to close the window.

OK, that was a configuration walkthrough for the mail client settings, to give you idea about various settings related to email client configuration.
Let’s see, another example, we will configure Mozilla Thunderbird Next.
Mozilla Thunderbird Configuration
After Thunderbird software Installation, if you open the application for the first time, it will open account setup window.
1. Please provide “Your full name”, “Email address”, and “Password”.
Now, if you Click “Continue”, it will try to find out the server to configure automatically, Or, you can click “Configure manually” Link, It will open the “manual configuration” page.

2. Now, here you can configure the Incoming and Outgoing mail server configuration details, with Hostname, Port, Security, Authentication method and Auth credentials.

3. After providing all the information, Click “Re-test” button, it will verify the configuration, if successfully verified, it will show the Green Notification box.

Now, Click the “Done” button to close the window, the thunderbird configuration is successful.
💻 Key Takeaways: Client Configurations
- Email clients like Outlook and Thunderbird must match incoming and outgoing server settings accurately.
- SMTP authentication must be enabled to prevent unauthorized outbound email relay.
- Always use correct ports and encryption methods provided by the email hosting provider.
- Modern clients support Auto-Discovery to simplify mail account setup with minimal manual input.
- IMAP and POP3 require the correct ports and credentials to retrieve emails securely from the server.
- Testing account settings ensures the configuration is valid and avoids common connection errors.
Chapter6:
Troubleshooting
Now, in this final chapter, we are going to discuss how to troubleshoot various issues that occur during day-to-day email operations.
Problems can arise for different reasons, and there are many issues we can address. However, we will focus specifically on issues related to incoming and outgoing emails and the servers that handle them.
We have created a table listing the issues, their possible causes, and how to troubleshoot them. This will help you find solutions quickly.
Let’s dive right in.
In this chapter, we are going to discuss the following:
Troubleshooting Incoming Email
Below, we have provided some common issues and troubleshooting steps related to incoming email. Since not all scenarios are the same, problems can occur for various reasons. Follow the guidelines to identify the actual cause of the issue and resolve it quickly.
📧 Issue | 🔍 Possible Causes | 🛠 Troubleshooting Steps |
---|---|---|
1. Incorrect Email Client Configuration |
|
|
|
| |
2. Email Delivery Delays |
|
|
|
| |
3. Missing Emails |
|
|
|
| |
|
| |
4. MX Records Misconfiguration |
|
|
5. Blacklist Issues |
|
|
6. Email Alias or Group Issues |
|
|
7. Auto-Reply or Vacation Message |
|
|
8. Spam Filter or Security Settings |
|
|
9. Domain or Account Issues |
|
|
10. Storage Issues (Quota) |
|
|
Troubleshooting Outgoing Email
Below, we have listed some common problems, possible causes, and troubleshooting steps related to outgoing email. Issues can arise at different stages during the sending of outbound emails. By following the guidelines, you can rectify these issues quickly.
📧 Issue | 🔍 Possible Causes | 🛠 Troubleshooting Steps |
---|---|---|
1. Verify SMTP Server Settings |
|
|
2. Disable Antivirus or Firewall |
|
|
3. Review Outbox for Stuck Emails |
|
|
4. ISP Blocking SMTP Port |
|
|
5. Email Sending Limits |
|
|
6. SMTP Authentication Issues |
|
|
7. SMTP Server Down or Malfunctioning |
|
|
8. Test with Another Email Client |
|
|
In summary, when troubleshooting incoming and outgoing emails, it’s important to identify the root causes through careful inspection. In both cases, reviewing logs, reproducing the issue, and following the troubleshooting steps will help resolving the problems efficiently.
🛠️ Key Takeaways: Troubleshooting Email Issues
- Verify DNS records like MX, SPF, DKIM, and DMARC to ensure domain email legitimacy.
- Ensure that required email ports (SMTP, POP3, IMAP) are open and not blocked by firewalls or ISPs.
- Use tools like Telnet or MXToolbox to test connectivity and server responses in real time.
- Analyze mail server logs (SMTP, MTA, MDA) to identify rejection causes, delays, or misroutes.
- Check for blacklist issues or spam filtering services that might block or delay outbound mail.
- Implement redundancy and fallback servers to minimize downtime and maintain high availability.
This is it !!
In this guide, we explained what are incoming and outgoing mail servers, with their functions, using examples and illustrations. We also provided a step-by-step approach to learn each concept.
I hope this guide will help you easily understand and master the design, deployment, configuration, and troubleshooting of incoming and outgoing mail servers.
Now, we want to hear from you
Did we miss anything? Are any of the steps unclear and need further explanation? If you want us to cover any other tutorials, please let us know by leaving a comment below.
Your feedback is very important. It helps us to improve and provide better content.
Thanks👍