Concept of Send-Mail
When we are going to send any mail from one system to other user, then the SEND-MAIL server will work three states. These states are given below,
I. MUA - Mail User Agent
II. MTA - Mail Transfer Agent
III. MDA - Mail Delivery Agent
There are some important protocols, which are used for sending or receiving mail,
a. SMTP - Simple Mail Transfer Protocol is used for sending mail and the port number is 25.
b. IMAP - Internet Mail Access Protocol is used for receiving mail from other, and the port number is 143.
c. POP - Post Office Protocol is also used for receiving the mail and the port number is 110.
We need to install three rpm for SEND-MAIL server,
To install Sendmail
[root@www root]# rpm -q sendmail
ð This package is need for server side to send mail or e-mail.
[root@www root]# rpm -q sendmail-cf
ð To configure send-mail server we need this package. After installation the rpm, it creates two configuration files named sendmail-cf and sendmail-mc in /etc/mail/ directory. The original configuration file’s name of send-mail is sendmail-cf but it is not editable by user. For this reason we need another package to configure the server.
[root@www root]# rpm -q m4
ð m4 package is a compiler which converts sendmail-mc file to sendmail-cf. That means while we shall edit the sendmail-mc file to configure new configuration of sendmail we must use m4 command.
To configure sendmail
1). The configuration file of the SEND-MAIL server is "sendmail.cf"
[root@www root]# vi /etc/mail/sendmail.cf
ð But, don't edit this file. To change this file we have to go to other file called "sendmail.mc".
[root@www root]# vi /etc/mail/sendmail.mc
ð Some lines of the file is started by dnl, it means that lines are not being read by the sendmail. We get a line in this file which starts with the option as DAEMON_OPTION (Boldly given in above). Comment that line by adding "dnl" before the line. Example,
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
2). Now we shall compile the sendmail.mc file by using the below command.
[root@www root]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
ð m4 is nothing but a compiler. It will convert the "sendmail.mc" file to "sendmail.cf" file.
[root@localhost root]# service sendmail start
ð To start the send-mail server.
[root@www root]# sendmail -d0 -v
Compiled with: DNSMAP HESIOD HES_GETMAILHOST LDAPMAP LOG MAP_REGEX
MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6
NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF STARTTLS TCPWRAPPERS
============ SYSTEM IDENTITY (after readcf) ================
(short domain name) $w = www
(canonical domain name) $j = www.home.com
(subdomain name) $m = home.com
(node name) $k = www.home.com
Recipient names must be specified
ð It will show the host name, domain name, FQDN etc.
4). To receive the mail, we need another rpm called "imap.rpm"
[root@localhost RPMS]# rpm -ivh imap.rpm
ð The post office protocol( pop ) also includes the "imap.rpm". The configuration file of pop is "ipop3",
[root@localhost root]# vi /etc/xinetd.d/ipop3
ð In the file, we should change the option "Disable" equal "no". Such that
Disable = no
Now start the xinetd service,
[root@localhost root]# service xinetd start
All the mails are stored in the directory called "/var/spool/mail",
[root@localhost root]# cd /var/spool/mail
ð Show all the mails.
In the user's home directory there is a file "mbox". All the mail is stored in this file.
[root@localhost root]# vi mbox
To give an alias name to individual or a group
[root@localhost root]# vi /etc/aliases
ð Some important lines of the file are given below,
linux : Root
#person who should get root's mail
#sumon is a normal user
root : sumon
#Basic system aliases - There must be present
mygroup : sumon,azgar,root
ð When we send a mail to mygroup then this mail automatically send to sumon, azgar, and root user. After editing the "aliases" file we must be give the command as,
[root@localhost root]# newaliases
ð Now the aliases file will active.
[root@localhost root]# mail email@example.com
[root@localhost root]# mail firstname.lastname@example.org
[root@localhost root]# mail mail.iiht.com
ð Those are the example for sending mail to users.
Note: For send-mail server, you must create first a Name Server (NS).