Basic mail Server and Null Mail client setup in Centos 7

Instead of using postconf command line tool I prefer to edit /etc/postfix/, because there are some example configurations in the file so I don’t have to mock up commands and steps.

Mail Server Configuration

Package to be installed:
#postfix should be preinstalled with centos7 Linux.
yum -y install postfix
#Enable on startup
systemctl enable postfix
vi /etc/postfix/

#modify following parameters

#to accept mail traffice from all hosts
inet_interfaces =all

# to accept mail from your domain. For example: from shiba.local in my
# example of IPA Server (authentication server).
# $mydomain variable will give domain portion of the mail server.
myorigin = $mydomain

#accept traffic from subnet only
mynetworks =

#accept traffic for $mydomain destination

Configuring null client (to forward mail to SMTP server)

vi /etc/postfix/

#find relayhost and give ip/DNS host name in it. mail.shiba.local is my mail server which
# was configured in above step.

#it is default you don’t have to modify
 inet_interfaces =loopback-only

#by default it is not set to any subnet, which should work, but if you are ask to set
# target network to localhost only you have to do it

#if you are ask to define destination domain, you have to do it otherwise you can avoid this line

Alternatively use postconf command -e option is to edit config:
postconf -e ‘relayhost=[mail.shiba.local]’
postconf -e “inet_interface=loopback-only”
postconf -e “mynetwork=″
postconf -e “mydestination=”

Note: You are only working with client side of mail server. So you don’t have to configure SELinux and Firewall to allow inbound mail configuration. Also note if you are only using IPv4, then don’t forget to set inet_protocols=ipv4 instead of inet_protocols=all.

Sending mail from null mail client:
From the client Linux machine where you have configured null mail client type following commands

echo “test mail” > myfile.txt
mail -s “test mail” shiba@shiba.local < myfile.txt

You can view mail log to verify if there is any issue in mail delivary:

tail -f /var/log/maillog

To Verifying mail in mail server:
1. Switch to the user
su – shiba
2. check mail using mail command
mail <enter>

if you got mail in the server, you can enter mail id number shown in the list to view content of the mail. to quit from mail client press q.

Leave a Reply

Your email address will not be published.

one × = 5

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent Posts
Recent Comments
    Updates on Recent activieies