Configure Postfix SMTP Relay (Smart Host) on CentOS 8

Install and Configure Postfix SMTP Smart Host on CentOS
Postfix is a Mail Transport Agent (MTA), which can be easily configured as a private relay host, passing mail to another mail servers. Unlike Sendmail, Postfix is considered as a very secure MTA, offering a high level of flexibility and ease of administration.
In this article I am configuring Postfix on CentOS 8 as SMTP smart host (relay host) using SASL authentication to send out mail further to OVH mail server.

1. Install Postfix

Postfix should be preinstalled on CentOS 8 by default. If for some reason you don’t have the service installed, use the below command to install the relevant package:

[root@chronos ~]# dnf install postfix

2. Install SASL plugin

Package cyrus-sasl-plain contains the Cyrus SASL plugins which support PLAIN and LOGIN authentication.

[root@chronos ~]# dnf install cyrus-sasl-plain

3. Edit the configuration file

I am configuring the service to act as SMTP smart host, sending the mail to OVH mail server (, which is my ISP mail server, using SASL authentication (login and password).

Edit /etc/postfix/ configuration file and update the below relevant lines:

meta_directory = /etc/postfix
myhostname = chronos
mydomain =
local_transport = error: this is a null client
myorigin = $myhostname.$mydomain
# list of trusted network addresses, that can relay through this MTA
mynetworks = [::1]/128
relayhost = []
disable_dns_lookups = yes

# SASL authentication 
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps =
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt

4. Test the configuration

Test the configuration for any obvious errors. If the configuration is correct, the below command should not give any output:

[root@chronos ~]# postfix check

5. Start and enable Postfix service

Launch and enable Postfix daemon:

[root@chronos ~]# systemctl start postfix
[root@chronos ~]# systemctl enable postfix

6. Test the e-mail delivery

Verify the configuration by sending the test e-mail from command line.
Prepare test e-mail body:

[gjuszczak@chronos ~]# echo "Subject: Mail Delivery Test" > /tmp/mail.txt
[gjuszczak@chronos ~]# echo "This is the example e-mail body" >> /tmp/mail.txt

Send the test e-mail using sendmail script vith increased verbosity:

[gjuszczak@chronos ~]# sendmail -v < /tmp/mail.txt

Monitor system journal to check if the e-mail was successfully relayed to OVH mail server:

[root@chronos ~]# journalctl -u postfix
Jan 18 00:30:05 postfix/smtpd[14611]: connect from localhost[]
Jan 18 00:30:06 postfix/smtpd[14611]: 08A7F40E5250: client=localhost[]
Jan 18 00:30:06 postfix/cleanup[14614]: 08A7F40E5250: message-id=<>
Jan 18 00:30:06 postfix/qmgr[8420]: 08A7F40E5250: from=<>, size=573, nrcpt=1 (queue active)
Jan 18 00:30:06 postfix/smtpd[14611]: disconnect from localhost[] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
Jan 18 00:30:07 postfix/smtp[14615]: 08A7F40E5250: to=<>,[]:25, delay=1.1, delays=0.14/0.05/0.62/0.27, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as E3F06E696754)
Jan 18 00:30:07 postfix/qmgr[8420]: 08A7F40E5250: removed

Last but not least – check the recipient’s Inbox (or SPAM box), the test e-mail should be delivered successfully.

If for some reason the e-mail has not arrived yet, you can display mail queue on your relay host:

[root@chronos ~]# mailq