mail server on centos 8

------------

Install Postfix.

#  dnf -y install mailx mutt nmap postfix* 

postconf -A

postfix check

postconf -v

postconf -h

postconf -n

Run the following command and you will see pcre is now supported.

postconf -m

systemctl enable postfix

systemctl restart postfix

useradd -m -p VCX97jg6iZebc -s /sbin/nologin accesstel

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin u1

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin u2

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin virusalert

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin virusmails

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin spamalert

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin spam.police

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin sys_admin

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin inmail

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin outmail

useradd -m -p 4w5yRzfvfQFAI -s /sbin/nologin junkmail

# cd /etc/postfix

touch body_checks

touch recipient_bcc

touch sender_bcc

touch block_attachments

touch allowed-users

touch restricted-mail-groupsvi 

touch local_domains

touch restricted_senders

cp /etc/aliases /etc/postfix/aliases

cp main.cf main.cf.ORG

cp master.cf master.cf.ORG

cp aliases aliases.ORG

cp access access.ORG

cp /etc/postfix/main.cf /etc/postfix/main.cf.ORG

cp /etc/postfix/master.cf /etc/postfix/master.cf.ORG

# vi /etc/postfix/main.cf

135  # inet_interfaces = localhost

138  # inet_protocols = all

183  # mydestination = $myhostname, localhost.$mydomain, localhost

709 # smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem

715 # smtpd_tls_key_file = /etc/pki/tls/private/postfix.key

This example shows to configure SMTP-Auth to use Dovecot's SASL function.

[root@mail ~]# vi /etc/postfix/main.cf

# line 95: uncomment and specify hostname

myhostname = mail.worldcm.net

# line 102: uncomment and specify domain name

mydomain = worldcm.net

# line 118: uncomment

myorigin = $mydomain

# line 135: change

inet_interfaces = all

# line 138: change it if use only IPv4

inet_protocols = ipv4

# line 183: add

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# line 283: uncomment and specify your local network

mynetworks = 127.0.0.0/8, 10.0.0.0/24

# line 438: uncomment (use Maildir)

home_mailbox = Maildir/

# line 593: add

smtpd_banner = $myhostname ESMTP

# add follows to the end

# for example, limit an email size for 10M

message_size_limit = 10485760

# for example, limit a mailbox for 1G

mailbox_size_limit = 1073741824

# SMTP-Auth setting

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

[root@mail ~]# systemctl enable --now postfix

[3] If Firewalld is running, allow SMTP service. SMTP uses [25/TCP].

[root@mail ~]# firewall-cmd --add-service=smtp --permanent

success

[root@mail ~]# firewall-cmd --reload

success

--------