How To Configure And Install Sendmail In Linux?


Send mail is one of the old and widely used mail delivery agent/Mail system.

First Please check this link to know more about Mail Server

Configuration Of Sendmail :
1. All the sendmail configuration files are located at /etc/mail
2. Main configuration files are access, and send
3. In this example my domain is and my mail server host-name is

Step1 : Install sendmail packages
#yum install sendmail*
#yum install m4

Step2 : Configure DNS entries in forward look-up zone file
#vi /path/to/your/forward/lookup/zone/file
Save the file and exit.

Step3 : Check for configuration errors and reload the DNS server
#named-checkzone /path/to/your/forward/lookup/zone/file
#service named reload

Step4 :
All the sendmail configuration files are stored in /etc/mail and now configure relay ip address list

Why we require this relay list?
Ans : This is because to secure your sendmail not get spam. So what ever Network/host-names you specified in this access file those networks/host-names only get access to our sendmail.
#vi /etc/mail/access

Entries as follows.
Save and exit the file

Step5 : Now update the file to sendmail database with makemap command

Note : After executing below command you will find access.db, this is the indication that your makemap command worked perfect and database have been updated successfully.

Note : So if you want to relay more networks you have to edit access file.
#makemap hash access < access

Step6 : Configure file
#vi /etc/mail/

Step6(a) : Search for "confAUTH_OPTIONS" with out quotes open a new line after that and enter below entry in that line
define(`confDOMAIN_NAME', '')dnl

Caution : When using the quotes, "`" opening quote is near to escape key and "'" closing quote is at enter key.

Search for 127.0.0 line and comment that line if its not commented.
dnl #DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')dnl

Step6(c) : Search for LOCAL_DOMAINN with out quotes and modify the line as below from.


Step6(d) : Search for "MASQUERADE_AS" with out quotes and modify the line as below from..
dnl MASQUERADE_AS(`')dnl


Now save the file and exit

Step7 : Now compile changes to reflect them in
#m4 >

Step8 : Now start/restart the sendmail service
#service sendmail restart

Step9 : Now add the sendmail service to chkconfig list to start automatically at booting times
#chkconfig sendmail on

Dovecot Configuration :

Step1 : Install the dovecot package
#yum install dovecot

Step2 : Search for "protocols" in /etc/dovecot.conf file and replace with below mention line.
#vi /etc/dovecot.conf#protocols = imap imapsReplace this to
protocols = pop3 imap imaps

Step3 : Start the dovecot service.
#service dovecot restart

Step4 : Now add the dovecot service to chkconfig list to start automatically at booting times
#chkconfig dovecot on

Testing the mail server

Step1 :
Try sending mail using telnet command
#telnet 25
Server responds with: 220 SMTP then type HELLO

Now Server responds with: 250 OK now send MAIL

Now Server responds with: 250 Address Ok. Now type

Now Server responds with: 250 OK. now type DATA to enter mail content.

Now Server Responds (or may not): 354 Enter Mail
Enter message, then on a new line,.


Now the message will be sent to
Now log-in to that user and try to see the mail.


Here you can see your mail.As send mail configuration is huge and depends on the requirement. Here the configuration which I have shown you is basic configuration.

Some FAQ's:

Q. What is the port number for SMTP?
Ans : 25

Q. What is the port number for POP3, IMAP?
Ans : 110, 143

Q. What is present sendmail version?
Ans : 8

Q. What are other highly used mail servers in world?
Ans : qmail, exchange etc

Do you want to find port numbers to other
protocols too?
Use google squared. My example is here

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Archive

    Translate this page


    The Linux Juggernaut | Copyright 2006-2009 Surendra Kumar Anne | Surendra's Home Page | Give us feedback how we are doing, Click here