NULL CLIENT (relays mails to a central server)

Configure postfix by editing /etc/postfix/main.cf, or send configuration from the terminal using postconf:

# postconf -e 'myhostname=srv.example.local'
# postconf -e 'mydomain=example.local'
# postconf -e 'myorigin=$mydomain'
# postconf -e 'inet_interfaces=loopback-only'
# postconf -e 'mydestination='
# postconf -e 'relayhost=[centralmail.example.local]'

Check postfix configuration:

# postfix check

Restart postfix:

# systemctl restart postfix


CENTRAL MAIL SERVER (gateway)

Configure postfix by editing /etc/postfix/main.cf, or send configuration from the terminal using postconf:

# postconf -e 'myhostname=centralmail.example.local'
# postconf -e 'mydomain=example.local'
# postconf -e 'myorigin=$mydomain'
# postconf -e 'inet_interfaces=all'
# postconf -e 'mydestination=$myhostname, localhost.$mydomain, localhost, $mydomain'

Check postfix configuration:

# postfix check

Restart postfix:

# systemctl restart postfix

Allow smtp in firewalld:

# firewall-cmd --permanent --add-service=smtp
# firewall-cmd --reload


TESTS

Install mailx:

# yum install -y mailx

Send a mail to the root user:

# echo test | mailx -s test root

Monitor with journalctl (if the mail is deleted, it has been sent):

# journalctl -xlf

Check the mail queue:

# mailq

Resend a mail stuck in the queue:

# postsuper -r ABCDEFGHI

Delete a mail stuck in the queue:

# postsuper -d ABCDEFGHI