Postfix is a popular open-source Mail Transfer Agent (MTA), that can be used to route and deliver email on a Linux system, also t is estimated that around 25% of public mail servers on the internet run Postfix:
yum -y install postfix
This example shows to configure SMTP-Auth to use Dovecot’s SASL function.
vi /etc/postfix/main.cf
# line 75: uncomment and specify hostname
myhostname = mail.yourdomain.com
# line 83: uncomment and specify domain name
mydomain =yourdomain.com
# line 99: uncomment
myorigin = $mydomain
# line 116: change
inet_interfaces = all
# line 164: add
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# line 264: uncomment, and specify your local network
mynetworks = 127.0.0.0/8, 10.0.0.0/24
# line 419: uncomment (use Maildir)
home_mailbox = Maildir/
# line 574: add
smtpd_banner = $myhostname ESMTP
# add follows to the end
# limit an email size for 10M
message_size_limit = 10485760
# limit a mailbox for 1G
mailbox_size_limit = 1073741824
# for SMTP-Auth
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions =
permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
systemctl restart postfix
systemctl enable postfix
If Firewalld is running, then allow SMTP service. SMTP uses 25/TCP.
firewall-cmd --add-service=smtp --permanent
firewall-cmd --reload