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, sendmail.mc and send mail.cf.
3. In this example my domain is example.com and my mail server host-name is mx.example.com

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 example.com /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 sendmail.mc file
#vi /etc/mail/sendmail.mc

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', 'example.com')dnl

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

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

Step6(c) : Search for LOCAL_DOMAINN with out quotes and modify the line as below from.
LOCAL_DOMAIN(`localhost.localdomain')dnl

to
LOCAL_DOMAIN(`mx.example.com')dnl

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

to

MASQUERADE_AS(`example.com')dnl
Now save the file and exit

Step7 : Now compile sendmail.mc changes to reflect them in sendmail.cf
#m4 sendmail.mc > sendmail.cf

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 mx.example.com 25
Server responds with: 220 mx.example.com SMTP then type HELLO
HELLO

Now Server responds with: 250 OK now send MAIL FROM:root@example.com

Now Server responds with: 250 Address Ok. Now type


Now Server responds with: 250 user@example.com OK. now type DATA to enter mail content.

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

exit

Now the message will be sent to user@example.com.
Now log-in to that user and try to see the mail.
#su

user$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
  • Related Posts by Categories



    0 comments:

    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