There are three main software components in any mail server that allows you to send and receive an email with a local mail client:
1 MTA: The Mail Transfer Agent (MTA) is a program that transmits email between your server and the Internet, whether it’s delivering an email from the outside or sending an email from your server. Accepted inbound mail is queued on the server by the MTA.
2 MDA: The Mail Delivery Agent (MDA) saves mail from the MTA’s queue to individual mailboxes.
3 IMAP/POP3 Server: It keeps track of users and their mailboxes as they use IMAP/POP3 to check their email.
The Mail Server Process
1 An incoming message is routed over DNS to your mail server.
2 After passing through the MTA and MDA, it is placed in the server’s mailbox.
3 The IMAP/POP3 server servers as a connection mediator between the server and the local mail client whenever the message is being requested.
4 Outgoing mail is sent from the user’s local mail client, which is then processed by MTA before being forwarded to its Internet destination.
Mail Transfer Agents (MTA)
MTAs are in charge of dealing with SMTP connections to your server from both external senders and users. The following MTA services are the most popular:
1. Exim is cutting-edge and geared toward adaptability. It’s safe, but it’s not nearly as secure as Postfix. It’s highly adaptable, but it’s also one of the most difficult MTAs to set up.
2. Postfix is a modern, secure, and adaptable mail server. It’s a tad easier to set up than Exim.
Mail Delivery Agents (MDA)
Email is moved from the MTA’s queue to individual mailbox directories by MDAs. Your mailbox, for example, maybe found at /var/mail/example.com/user/. Local Delivery Agents are another name for MDAs (LDAs). Different types of mailboxes are supported by different MTAs. MDAs are frequently packaged with other mail-related programs.
The following are some of the most well-known MDAs:
1. The Cyrus MDA is a component of the Cyrus IMAP/POP3 server. Cyrus is a secure IMAP/POP3 server developed for usage on systems where users do not login directly.
2. Deliver is a simple Linux mail delivery utility that is installed by default in the Imapd configuration files.
3. The LDA and LMTP servers in Dovecot are part of the Dovecot IMAP/POP3 server. Dovecot is a customizable, lightweight, and modern mail server.
4. The MDA for Postfix is included in the Postfix MTA software. Postfix is a modern, secure, and adaptable MTA.
IMAP and POP3 Servers
Incoming IMAP or POP3 connections are handled by an IMAP or POP3 server. Client access to mailboxes and raw mail files is managed by the server, which ensures that email is displayed in a current manner. IMAP and POP3 are supported by the majority of servers and clients.
POP3 clients connect to the server at pre-determined intervals and download all of a user’s messages, leaving no copies on the server. POP3 was created when most users only had one device with which to access their email accounts.
IMAP is a more recent standard that was created with multi-device users in mind. IMAP clients maintain a constant connection to the server, and IMAP mailboxes are mirrors of your server’s mailboxes.
Secure versions of IMAP and POP3 (IMAPS and SSL-POP) use SSL encryption for mail transfer.
The following are the most popular IMAP and POP3 servers:
1. Citadel is a one-stop shop for email, calendars, instant messaging, mailing lists, and other collaboration tools. It’s free and open-source, and it’s aimed at small and medium-sized businesses.
2. Cyrus is a modem, security-focused IMAP/POP3 Server that is used on closed servers whenever users do not login directly to the server.
3. Dovecot is a configurable, lightweight, and modern mail server.
4. Zimbra is an all-in-one email service that is easier to set up than other options but has fewer customization options.
Software Installation Process
Install and configure the MTA, MDA, and IMAP/POP3 servers to set up your email server. To set it up on Ubuntu or Debian, follow these steps:
1. Install Postfix Mail Server
$ Sudo apt-get install postfix
During installation, you will be prompted to select your server’s default file configuration. It next asks you to choose a type of mail setup, and you should select “Internet Site.” Now type in the fully qualified domain name (FQDN) that you’d like to use to send and receive emails. Restart the Postfix mail server after you’ve set the FQDN:
$ sudo service postfix restart
2. Installing Dovecot
Run the following command to install it:
$ sudo apt-get install dovecot-imapd dovecot-pop3d
If you are asked if you wish to create a self-signed SSL certificate during the installation process, select Yes. Then, for the SSL certificate, type in your hostname. Restart the Dovecot service after that:
$ sudo service dovecot restart