Setting up Postfix configuration
Set up and validate Postfix configuration.
About this task
Set up an email on the NPS docker.
Procedure
-
As
root
, check if Postfix is installed inside the docker container:systemctl status postfix
- As
root
, change the Postfixsmtp
port to51025
inside the docker container:sed -i -e '/^smtp.*inet.*smtpd/s/^smtp/51025/' /etc/postfix/master.cf
- As
root
, enable Postfix inside the docker container:systemctl enable postfix
- As
root
, copy the modified Postfixmaster.cf
file to the containers on other control plane nodes:docker cp ipshost1:/etc/postfix/master.cf /tmp
for dev in node2 node3; do scp /tmp/master.cf $dev:/tmp; ssh $dev "docker cp /tmp/master.cf ipshost1:/etc/postfix/master.cf"; done
- As
root
, start Postfix inside the docker container:systemctl start postfix
- Run the mailx command to check if you can send an email:
(ex:echo "Hi" | mailx -s "Just Postfix" "destination e-mail ID"
- Run mailq to check if the emails are stuck in queue.
- Check if the email is in /var/log/maillog. Look for the error:
(Sep 27 06:38:39 vt-nps01 postfix/error[405759]: C74C02800637A: to=example@us.ibm.com, relay=none, delay=0.01, delays=0/0/0/0, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=us.ibm.com type=MX: Host not found, try again)
- Add a
relayhost
to /etc/postfix/main.cf.Example:#relayhost = $mydomain #relayhost = [gateway.my.domain] #relayhost = [mailserver.isp.tld] #relayhost = uucphost #relayhost = [an.ip.add.ress] Add the relayhost entry as follows: #relayhost = $mydomain #relayhost = [gateway.my.domain] #relayhost = [mailserver.isp.tld] #relayhost = uucphost #relayhost = [an.ip.add.ress] relayhost =