Send Receive Email from CentOS Client Computer

Send And Receive Email from Domain Join CentOS Linux 7 Client Computer By Use of Postfix Server

In this Scenario we will send email from OpenLDAP Domain Join CentOS Linux 7 client computer and check receive email from Postfix Server by use of SSH.

To check the Host name and hosts file of CentOS Linux 7 client computer "ldapdnsclient" type the  commands mention below.

hostname
cat /etc/hosts

send email through client computer by use postfix on centos 7

To check the IP configuration of CentOS Linux 7 client computer "ldapdnsclient" type the command mention below.

cat /etc/sysconfig/network-scripts/ifcfg-ens33

send email through client computer by use postfix on centos 7

To check the nameserver entry in "resolv.conf" file that available in "/etc/resolv.conf" directory type the below command, you must add your nameserver entry by use of "vi" editor.

cat /etc/resolv.conf

send email through client computer by use postfix on centos 7

In the above image first nameserver is OpenLDAP and DNS Server IP address and Second nameserver is the router IP address.

Authenticate CentOS Linux 7 client machine from OpenLDAP Server click on >>Read.

Add Host and PTR record of CentOS Linux 7 client computer "ldapdnsclient" go to OpenLDAP and DNS Server.

OpenLDAP and DNS Server "LDAP-DNS":

Installation and Configuration of  DNS Server For OpenLDAP Server on CentOS 7 click on >>Read.

To enter in the directory of forward and reverse lookup zone file use cd command and list files and folders by use of ls command inside the directory. The both commands are mention below.

cd /var/named/
ls

send email through client computer by use postfix on centos 7

To edit the host entry of CentOS Linux 7 client computer "ldapdnsclient" in forward lookup zone file that is pakistan.local.forward type the command mention below.

vi pakistan.local.forward

send email through client computer by use postfix on centos 7

Add the below mention lines in pakistan.local.forward file.

$TTL 86400
@       IN SOA  ldap-dns.pakistan.local. root.pakistan.local. (
           2011071002       ;Serial
           3600             ;Refresh
           1800             ;Retry
           604800           ;Expire
           86400            ;Minimum TTL
)
@          IN   NS   ldap-dns.pakistan.local.
@          IN   A    192.168.10.215
ldap-dns   IN   A    192.168.10.215
linux2     IN   A    192.168.10.216
linux2.pakistan.local     IN   A    192.168.10.216
ldapdnsclient IN A   192.168.10.218
ldapdnsclient.pakistan.local IN A   192.168.10.218

;Specify MX Record

                IN   MX  10  linux2.pakistan.local.
pakistan.local. IN   MX  10  192.168.10.216

send email through client computer by use postfix on centos 7


To edit the PTR record of CentOS Linux 7 client machine "ldapdnsclient" in reverse lookup zone file that is pakistan.local.reverse type the command mention below.

vi pakistan.local.reverse

send email through client computer by use postfix on centos 7

Add the below mention lines in pakistan.local.reverse file.

$TTL 86400
@       IN SOA  ldap-dns.pakistan.local. root.pakistan.local. (
           2011071002       ;Serial
           3600             ;Refresh
           1800             ;Retry
           604800           ;Expire
           86400            ;Minimum TTL
)
@           IN   NS     ldap-dns.pakistan.local.
ldap-dns    IN   A      192.168.10.215
215         IN   PTR    ldap-dns.pakistan.local.
216         IN   PTR    linux2.pakistan.local.
218         IN   PTR    ldapdnsclient.pakistan.local.

send email through client computer by use postfix on centos 7

Use rndc reload command for proper resolve Host entries.

rndc reload

send email through client computer by use postfix on centos 7


After edit the Host and PTR record of CentOS Linux 7 client machine "ldapdnsclient" in forward and reverse lookup zone files respectively, Check the CentOS Linux 7 client machine "ldapdnsclient" resolve DNS Server Host Name and itself by use of nslookup command.

To use nslookup command first install "bind-utils" package. To Install "bind-utils" package type the command mention below.

yum install bind-utils

send email through client computer by use postfix on centos 7

The "bind-utils" package has successfully installed.

send email through client computer by use postfix on centos 7

Check DNS Server is resolving from CentOS Linux 7 client Machine "ldapdnsclient" type the command mention below.

nslookup ldap-dns.pakistan.local

send email through client computer by use postfix on centos 7

Check CentOS Linux 7 client Machine "ldapdnsclient" is resolve its Full Qualified Domain Name "FQDN" type the command mention below.
 
nslookup ldapdnsclient.pakistan.local

send email through client computer by use postfix on centos 7

Send Email from OpenLDAP user "user1" to OpenLDAP user "user2" with domain name "pakistan.local".

To send email user1 to user2 type the below command. In email give subject and message then press dot "." for send email.

mail -v user2@pakistan.local

send email through client computer by use postfix on centos 7

To check email in user2 mailbox, ssh the Postfix Server "Linux2" and type mail command to check email.

mail

send email through client computer by use postfix on centos 7

In above image the email that user1 has send to user2 is number 17, type number 17 then press enter to check email and for reply type r give message then type dot "." to send the message. For Quit Heirloom mailx type q then press enter.

send email through client computer by use postfix on centos 7

To check the reply message that user2 reply to user1, first switch to user1 in Postfix Server "Linux2" then type mail command to check email.

su - user1
mail

send email through client computer by use postfix on centos 7

In above image the email user2 reply to user1 its number is 14, to check email type 14 then press enter.

send email through client computer by use postfix on centos 7

In above image you can see that reply message has received.

Thanks for read this Article

Comments