Wednesday, 20 April 2011

how to Configure Mail Server with Sendmail


Mail Server
Service profile
package:sendmail,sendmail-cf,sendmail-doc
Daemon:/usr/sbin/sendmail
startup script: /etc/init.d/sendmail
port:25
conf file: /etc/mail/sendmail.mc, /etc/aliases, /etc/mail/access, /etc/mail/virtusertable

Installing sendmail
Whether packages are installed or not           #rpm -qa | grep sendmail
Installing sendmail and relevent package        #yum install sendmail sendmail-cf sendmail-doc
Befor editing conf file the task                #hostname
  confirm about hostname and dns:               #hostname station17.example.com     [to user different damain]
                                                #hostname -f
                                                #dig $(hostname -f)
                                                #dig -t mx domainname
  confirm hostname master network:              #vim /etc/sysconfig/network
                                                      NETWORKING=yes
                                                      HOSTNAME=station17.example.com
  check                                         #vim /etc/mail/local-host-name
                                                      ipaddress
                                                      domainname
                                                      fqdn
Edit /etc/mail/sendmail.mc                      #vim /etc/mail/sendmail.mc
                                                      dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl     [line no 117]
                                                      LOCAL_DOMAIN(`example.com')dnl                                    [line no 155]
To rebuild sendmail.cf                          #m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
                                                #make -C /etc/mail
Initialize service                              #chkconfig sendmail on
Service restart                                 #service sendmail restart
check whether sendmail is working or not        #netstat -ntulp | grep sendmail
Invoke sendmail in debugg mode                  #sendmail -d0 < /dev/null     [to test whether hostname resolving correctly]
Testing sendmail                                #telnet server1.example.com 25
                                                      MAIL from: root@example.com
                                                      rcpt to: susan@example.com
                                                      data
                                                      Hi Every1
                                                      .
                                                      quit
ALIAS
1 Give entry in /etc/aliases                    #vim /etc/aliases
                                                      susan:      shuvo
2 to activate new alias                         #newaliases

VIRUALDOMAIN
1 edit /etc/mail/virtusertable                  #vim /etc/mail/virtusertable
                                                      virtual_domain    original_domain
                                                      virtual_email     original_user
RESTRCITING RELAY
1 by editing /etc/mail/access                   #vim /etc/mail/access
                                                      Domain      action
                                                      From:90trialspammeraol.com    REJECT
                                                      Connect:example.com           RELAY
                                                      Connect:192.168.9       RELAY
2 to effect /etc/mail/access run                #makemap hash /etc/mail/access.db < /etc/mail/access
  following command                             #service sendmail restart

MDA Configure
1 installing dovecot(pop3,pop3s,imap4,imap4s)   #yum install dovecot
                                                #chkconfig dovecot on
                                                #service dovecot start
2 testing dovecot whether its running or not    #netstat -ntulp | grep -i dovecot
3 To enable/disable protocol                    #vim /etc/dovecot
                                                      protocols=imap imaps pop3 pop3s      [uncommnet line, set protocol]
4 Restart service                               #service dovecot restart
5 Send mail using SMTP                          #telnet station17.example.com 25
                                                or
                                                #mutt
                                                      TO:
                                                      SUBJECT:
                                                      SEND (y):
6 Retrieve Mail from  POP3                      #telnet station17.example.com 110   [telnet cmd for pop3]
                                                      user susan        [user]
                                                      pass 123          [pass]
                                                      list              [view list]
                                                      retr              [retrieve]
                                                      quit              [quit]
                                                      dele              [to delete]

SECURE IMAP USING CERTIFICATE
1 install ssl module                            #yum install mod_ssl
2 Create certificate                            #make -C /etc/pki/tls/certs dovecot.pem
3 make entry on /etc/dovecot.conf file          #vim /etc/dovecot.conf
                                                      ssl_cert_file = /etc/pki/tls/certs/dovecot.pem
                                                      ssl_key_file = /etc/pki/tls/certs/dovecot.pem
4 restart the dovecot service                   #service dovecot restart
QUESTION
1 Configure your system as    MTA, Make sure that example.com domain can send your domain
2 Configure your server as POP3 server, Make sure that only example.com domain can access your POP3 service
3 Configure your server as IMAPS, Configure new certificate


No comments:

Post a Comment