A mail server consists of multiple components. A mail transfer agent (MTA) receives and sends emails via SMTP. Received and accepted emails are then passed to a mail delivery agent (MDA), which stores the mail in a mailbox (usually in mbox or Maildir format). If you want users to be able to remotely access their mail using email clients (MUA), you need to run a POP3 and/or IMAP server.
Below is a table containing all mail servers with the features they support.
|Name||Mail transfer agent||Mail delivery agent||Sendmail||Mailing list||Notes|
|dma||Yes||Yes||–||–||No||–||Does not support email domains; limited MTA receiving (see Use Google SMTP)|
|Postfix||Yes||Yes||–||–||Yes||Partially, through alias feature||–|
|Courier||Yes||Yes||Yes||Yes||No||Yes||Includes a web client|
|Cyrus IMAP||–||–||Yes||Yes||–||–||Can be installed from cyrus-imapd|
|UW IMAP||Yes using c-clientAUR||–||Yes||Yes||Yes c-clientAUR has same capabilities||–||Project is abandoned|
|msmtp||Yes||No||–||–||Yes msmtp has same capabilities||–||–|
|Sendmail||Yes||No||–||–||Yes||–||Sendmail implementation is deprecated|
|fdm||–||–||Yes||Yes||–||–||Can also fetch mail from standard input (stdin)|
|Procmail||–||–||Partially, see module ||No||–||–||Only reads mail through standard input (stdin), upstream is unmaintained|
|Maildrop||–||–||No||No||–||–||Only supports receiving emails over standard input (stdin)|
- Sendmail executables are command line tools which allow the sending of emails over SMTP.
- "Sending" and "Receiving" columns refer to the ability to send emails over SMTP and receive emails over SMTP.
- "Mailing list" software, allow for the creation of mailing lists, see Mailing lists.
|Accept mail from other MTAs.||25||SMTP||STARTTLS|
|Accept submissions from MUAs.||587||SMTP||STARTTLS|
|Let MUAs access mail.||110||POP3||STARTTLS|
- Implicit TLS is more secure than STARTTLS because the latter is vulnerable to man-in-the-middle attacks. For more information, see  and RFC:8314.
- The table above contains the generic ports to be used, however mail servers could use other ports, ensure to check with your mail provider to ensure the ports are correct. The only port which remains constant is port 25, the relay port is expected to be open otherwise emails will not be relayed through a specific server (However some software does support setting custom relay ports).
Hosting a mail server requires a domain name with an MX record pointing to the domain name of your mail transfer agent. The domain name used as the value of the MX record must map to at least one address record (A, AAAA) and must not have a CNAME record to conform with RFC 2181, otherwise you may not get mail from some mail servers. Configuring DNS records is usually done from the configuration interface of your domain name registrar.
There are various email authentication techniques.
Sender Policy Framework
- Sender Policy Framework (SPF) is an email validation protocol designed to detect and block email spoofing by providing a mechanism to allow receiving mail exchangers to verify that incoming mail from a domain comes from an IP Address authorized by that domain's administrators.
To allow other mail exchangers to validate mails apparently sent from your domain, you need to set a DNS TXT record as explained in the Wikipedia article (there is also an online wizard[dead link 2022-09-21 ⓘ]). To validate incoming mail using SPF you need to configure your mail transfer agent to use a SPF implementation. There are several SPF implementations available: libspf2, perl-mail-spf and perl-mail-spf-query.
|Sendmail||through Milter and spfmilter-acmeAUR|
|Exim||Yes, requires libspf2|
The following websites let you validate your SPF record:
v=spf1 -allmakes any mail server enforcing SPF reject emails from your domain name, thus preventing misuse.
Sender Rewriting Scheme
The Sender Rewriting Scheme (SRS) is a secure scheme to allow forwardable bounces for server-side forwarded emails without breaking the Sender Policy Framework.
For Postfix, see Postfix#Sender Rewriting Scheme.
DomainKeys Identified Mail (DKIM) is a domain-level email authentication method designed to detect email spoofing.
Available DKIM implementations are OpenDKIM and perl-mail-dkim.
There are several options to help you test DNS records, deliver ability, and encryption support.
There are several handy web sites that can help you testing.
- https://www.mail-tester.com/ (3 free tries only!)
Tips and tricks
Removing IP addresses from emails
Most mail servers can be configured to strip users' IP addresses and user agents from outgoing mail.
Scanning emails for viruses
See ClamAV for email antivirus scanning.
See SpamAssassin for filtering of spam emails.
See Roundcube and Squirrelmail for setting up of a webmail.
- Comparison of mail servers - Further comparison of mail servers, including ones which are not supported by Arch Linux
- Sieve – a mail filtering programming language