Linux online course

Linux Mail Servers: MTAs, Email Protocols, and Popular Options

Learn what Linux mail servers and MTAs do, how SMTP, ESMTP, POP3, and IMAP work, and how Sendmail, Postfix, Exim, and qmail compare.

A mail server is software that transfers and handles email messages between users and computer systems. On Linux and Unix systems, the component responsible for transferring messages is commonly called a Mail Transport Agent (MTA).

The mail server is not the same as the email client. An email client is the application a person uses to compose, send, and read messages. The mail server provides the network services that transfer messages and make stored messages available to clients.

What a Linux Mail Server Does

A mail server can accept an outgoing message from a user's email client, determine where the message must go, and transfer it to another mail server. It can also store messages for recipients so that their email clients can access them later.

For example, when a user sends a message, the client submits it to a mail server. The sending server uses an SMTP-family protocol to transfer the message toward the recipient's mail server. The recipient's client then accesses the stored message through POP3 or IMAP.

Email Sending and Receiving Workflow

  1. Composition: A user writes a message in an email client or webmail interface.
  2. Submission and transfer: The client sends the message through SMTP or ESMTP to a mail server. The server may then transfer it to the recipient's mail server using the same protocol family.
  3. Storage: The recipient's mail server stores the message in the recipient's mailbox.
  4. Access: The recipient's email client reads or retrieves the stored message using POP3 or IMAP.

The simple relationship is therefore:

  • SMTP and ESMTP: used to submit, send, or transfer email.
  • POP3 and IMAP: used by clients to receive, retrieve, or read email held on a mail server.

Sending mail: SMTP and ESMTP

SMTP means Simple Mail Transfer Protocol. It is a protocol used to send or transfer email between an email client and a mail server, or between mail servers.

ESMTP means Extended SMTP. It extends the original SMTP protocol with additional capabilities while serving the same general purpose: sending and transferring email.

Receiving mail: POP3 and IMAP

POP3 means Post Office Protocol version 3. It allows an email client to retrieve messages from a mail server. Depending on the client and its settings, messages may be downloaded for local use.

IMAP means Internet Message Access Protocol. It allows an email client to access and read messages that remain organized on the mail server. This model is useful when the same mailbox is accessed from multiple devices.

Email Protocols and Their Roles

Protocol — Expanded Name — Primary Role — Mail Activity

SMTP — Simple Mail Transfer Protocol — Sends or transfers email — Client submission and server-to-server delivery.

ESMTP — Extended SMTP — Extends SMTP for sending or transferring email — Client submission and server-to-server delivery with extensions.

POP3 — Post Office Protocol version 3 — Retrieves email — Client downloads or retrieves messages from a server.

IMAP — Internet Message Access Protocol — Accesses and reads email — Client works with messages stored on the server.

Mail Transport Agents and MTA Architecture

An MTA, or Mail Transport Agent, is the mail server component that transfers email between users and systems. MTAs commonly accept messages, apply routing rules, place messages in a delivery queue when necessary, and pass messages to another mail system.

One important way to compare MTAs is their architecture:

  • A monolithic MTA uses one principal program or binary to control the MTA's facilities.
  • A modular MTA is composed of multiple smaller programs, each with a more specific responsibility.

Architecture affects how administrators think about configuration, separation of tasks, security boundaries, maintenance, and reliability. A monolithic design can centralize control, while a modular design can separate responsibilities into smaller components.

Popular Linux Mail Servers

Four major Linux and Unix mail server choices are Sendmail, Postfix, Exim, and qmail. They all provide MTA functionality, but they differ in design goals, configuration style, and how their components are organized.

Popular Linux Mail Servers

Mail Server — Architecture — Key Characteristics — Configuration Perspective

Sendmail — Monolithic — Powerful and widely used on Unix and Linux systems — Flexible, but comparatively difficult to configure.

Postfix — Modular — Designed for easier administration, reliability, and security — Generally easier to understand and configure because tasks are separated.

Exim — Monolithic — One main binary controls the MTA's facilities; generally easier to configure than Sendmail — Centralized configuration with a simpler experience than Sendmail.

qmail — Modular — Designed around security, lightweight operation, and reliability — Separate components support task separation and its security-focused design.

Sendmail

Sendmail is a powerful and widely used MTA for Unix and Linux systems. It supports complex mail-routing requirements and has a long history in Unix mail administration.

For architectural comparison, Sendmail is considered monolithic. Its broad set of MTA facilities is controlled through a central program design. This power comes with a reputation for difficult configuration, especially for beginners or administrators handling complex routing rules.

Postfix

Postfix was designed as a replacement for, and alternative to, Sendmail. Its design uses multiple specialized programs rather than placing every responsibility in one main process. Each program performs a smaller individual task within the mail system.

This modular architecture supports the goals of easier configuration, reliability, and security. Separating responsibilities can make the system easier to reason about and can reduce the impact of problems in one component.

Postfix has been used as a default mail server on Linux distributions, including openSUSE as one example. The exact default and available packages depend on the distribution and its release.

Exim

Exim is a monolithic mail server. In this context, monolithic means that one main binary controls the MTA's facilities instead of delegating them to many separate programs.

Although Exim shares the monolithic classification with Sendmail, it is generally considered easier to configure than Sendmail. It therefore illustrates that architecture alone does not determine the complete administration experience: two monolithic MTAs can still differ substantially in configuration style and complexity.

qmail

qmail is a modular mail server whose central design goal is security. It is also intended to be lightweight and reliable.

Its modular structure divides work among smaller components with distinct responsibilities. This separation aligns with qmail's emphasis on limiting the scope of individual parts of the mail system while maintaining efficient operation.

Monolithic Versus Modular MTAs

The following classification is useful when comparing the four choices:

  • Monolithic examples: Sendmail and Exim.
  • Modular examples: Postfix and qmail.

With a monolithic MTA, one principal program handles the MTA's facilities. This can provide centralized control, but a large central configuration or program can be harder to understand and maintain.

With a modular MTA, several smaller programs handle separate responsibilities. This can improve separation of tasks and make individual functions easier to inspect. It may also introduce more components that administrators must understand and coordinate.

When selecting an MTA, compare more than its architecture. Consider configuration complexity, reliability, security design, operational goals, documentation, and the skills available to the administrator.

Practical Examples

Example: sending an email

A user composes a message in an email client and selects Send. The client submits the message to a mail server using SMTP or ESMTP. The sending MTA then transfers the message to the destination mail system using an SMTP-family protocol.

Example: reading received email

A recipient's mail server stores an incoming message. The recipient's email client connects using POP3 or IMAP. POP3 commonly focuses on retrieving messages, while IMAP lets the client access messages and their mailbox organization on the server.

Example: choosing an MTA

A learner who wants a powerful, established Unix MTA might study Sendmail, while also accounting for its configuration complexity. The learner might compare it with Postfix, whose modular design emphasizes easier administration, reliability, and security.

Example: identifying architecture

Classify Sendmail and Exim as monolithic MTAs because one main program controls their MTA facilities. Classify Postfix and qmail as modular MTAs because multiple smaller programs perform distinct tasks.

Exam-Relevant Notes

  • Mail server: software that transfers and handles email between users or systems.
  • MTA: Mail Transport Agent; the mail server component responsible for transferring email.
  • SMTP: Simple Mail Transfer Protocol; used to send or transfer email.
  • ESMTP: Extended SMTP; an extended form of SMTP used for sending email.
  • POP3: Post Office Protocol version 3; used by clients to retrieve email.
  • IMAP: Internet Message Access Protocol; used by clients to access and read email on a server.
  • Monolithic: one principal program or binary controls the MTA's facilities.
  • Modular: multiple smaller programs perform separate responsibilities.
  • Sendmail and Exim: monolithic examples.
  • Postfix and qmail: modular examples.

For related Linux foundations, see Linux concepts and tutorials and how Linux locates executable commands.