Install Postfix with Cyrus on CentOS RHEL Fedora

Overview

A mail infrastructure mainly consists of three main components MTA, MDA and MUA.

A MTA or Mail Transmission Agent or an outgoing server act as a major driver. Whenever a user clicks on send button to send an email it is sent to the local MTA which will look up the domain and decide which way to send this email. So if ryan from ryan@example1.com wants to send an email to his friend mary at mary@dummy1.com, as soon as he clicks the send button, it is delieved to the MTA running on his domain which will then forward the email to the MTA responsible for the domain dummy1.com (if it has a direct route) or to a MTA that has a possible route to domain dummy1.com. Some popular MTA’s are postfix, sendmail etc

MDA stands for Mail Delivery Agent, it is responsible for the delivery of e-mail messages to a local recipient’s mailbox. So when dummy1.com’s MTA receive mary’s email sent by ryan, it will forward that email to the local MDA. The MDA then delivers the email to mary’s mailbox so that the next time Mary uses its MUA such as Outlook or Thunderbird, she can fetch that email from her mailbox. Some popular MDA’s are cyrus, dovecot etc

MUA stands for mail user agent which is just an email client, email reader, or is any computer or web program used to access and manage a user’s email. Some popular MUA’s are thunderbird, Microsoft outlook etc

Install Postfix with Cyrus on CentOS RHEL Fedora

This guide has been tested on CentOS/RHEL 5.6,5.7,5.8,5.9,6.1,6.2,6.3,6.4

Postfix does not comes with an authentication of its own. If you do not want your MTA to act as an open relay then you need some sort of authentication mechanism in place, thankfully we can use cyrus or davecot sasl authentication modules. Cyrus and Davecot are two popular MDA’s and you can select anyone of these, for this post I would be using cyrus.

Install postfix and cyrus-sasl

Create certs for TLS communication and move it to the postfix directory

Once installed open the postfix main conf file and update the following feilds as per your requirements.

Make sure you set the following parameters, replace the hostname and mydomain with your domain.

Also append the following to the file to make sure that your postfix server isn’t an open relay.

Next edit smtpd.conf

Make sure the pwcheck method is set to sasalauthd and mech_list is PLAIN LOGIN

Restart postfix daemon

Open imapd.conf file in an editor of choice

Make sure the fields look like these

Start cyrus imapd and saslauthd service

Create some users.

Open a mail client and enter the settings for the imap and smtp server.

postfix02 300x187 Install Postfix with Cyrus on CentOS RHEL Fedora

Send a test email

postfix04 300x176 Install Postfix with Cyrus on CentOS RHEL Fedora