Showing posts with label Mail Servers. Show all posts
Showing posts with label Mail Servers. Show all posts

How To Configure And Install Sendmail In Linux?

0 comments

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
  • Server configuration file syntax Checking commands

    2 comments

    SERVER CONFIGURATION FILE SYNTAX CHECKING COMMANDS.

    I have planned to write this post some long time ago, now the time has come to do it.

    Basically configuring servers in Linux/*nix include editing of configuration files and saving them. Once editing the files if any syntax error is there and when we start the service they will show some wearied errors which we cant resolve.
    For counter attacking this type of issues for each service there will be one command to check this syntax errors before starting of the service/server, I have collected these commands from my experience and from some of my friends. Please feel free to comment on this if you know some other commands so that I will update my post.

    SSHD server check for syntax error
    =========================
    sshd -t

    FTP server check for syntax error
    =========================
    #vsftpd

    DNS server check for syntax error
    ==========================

    For checking syntax errors in main configuration file..
    #named-checkconf main-config-file

    Example:
    #named-checkconf named.conf

    Syntax OK

    #named-checkzone domain zonefile-loc

    Example:
    #named-checkzone example.com /var/named/chroot/var/named/exaple-zone.frd

    SAMBA server check for syntax error
    =============================
    #testparm

    APACHE server check for syntax error
    =============================
    httpd -t

    For virtual hosts

    httpd -t -D DUMP_VHOSTS

    TCP Wrappers check for syntax error
    ============================
    tcpdchk
    tcpdchk -v


    Postfox server check for syntax error
    ============================
    postfix check
    postfix -vv


    LIGHTTPD
    server check for syntax error
    =============================
    lighttpd -t -f /etc/lighttpd/lighttpd.conf

    Squid
    server check for syntax error
    ==========================
    squid -k check
    squid -k parse


    NAGIOS server check for syntax error
    ====================================
    /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Mail system explained

    1 comments

    Send-mail

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





    Sl.no Agent Description from Wikipedia
    1 Mail User Agent(MUA) An e-mail client (also mail user agent (MUA) or e-mail reader) is a frontend computer program used to manage e-mail.
    2 Mail Transfer Agent(MTA) A mail transfer agent (MTA) (also called a mail transport agent, message transfer agent, or smtpd (short for SMTP daemon), is a computer program or software agent that transfers electronic mail messages from one computer to another.The term mail server is also used to mean a computer acting as an MTA that is running the appropriate software. The term mail exchanger (MX), in the context of the Domain Name System formally refers to an IP address assigned to a device hosting a mail server, and by extension also indicates the server itself.
    3 Mail Delivery Agent(MDA) A Mail delivery agent (MDA) is software that delivers e-mail messages after they have been accepted on a server, distributing them to recipients' individual mailboxes.
    4 Mail Access Agent(MAA) A way of remotely accessing a mail-spool, for example POP3 or IMAP.


    A short description how a Mail communication will work:

    Here I will take an example how a mail from John(john@domain1.com) to his friend Jelo(jelo@domain2.com) will be delivered.


    Step1:first John has to write a e-mail by specifying who is the receiver of this mail(in this case it is Jelo).So  things like composing mails will be taken care by MUA.this MUA( A mail client such as MS outlook,Thunder-bird etc) knows how to deals with mail transportation,Once Jhon press send and receive in e-mail client,MUA initiate talk with its MTA(A SMTP server which is listening  on 25 port for receiving mails).

    Step2:Once MTA(such as SEND-MAIL,Qmail,Post-Fix etc) get the request from MUA, MTA will take care of all the activity such as communicate with MUA and fetching mails from MUA etc.

    Step3:Once MTA got the mails from MUA, it has to segregate all the mails according to different domains. for example Jhon is sending 4 mails(one to Jelo@domain2.com, one to jennie@domain2.com, one to anne@yahoo.com and one to raja@gmail.com) this MTA will segregate these 4 mails in to 3 pools(jelo and jennie mails will be pooled in same pool so that they will be delivered to domain2.com,anne mail will be pooled to yahoo.com and raja's mail will be pooled to gmail.com)

    Step4:Once the segregation has happened MDA(nothing but again its a send-mail which will take care of )will delivered these mails to respective MAA(such as Dovecot ).

    Step5:Now suppose mail has delivered to their respective MAA's. Once the mail reaches, MAA will try to segregate the mails according to users(here for example Jelo and Anne mails has arrived to domain2.com MAA) then this MAA will put the mails of Jelo and Anne in respective mails boxes in a Mail Store(MS) as shown in Figure.

    Step6:Now MUA will come in to picture in downloading these mails from MAA, so MUA will communicate with MAA and download the mails to MUA(like outlook and thunder-bird).

    Please comment on this and we will post basic configuration of Sendmail in my comming posts.



    Enhanced by Zemanta

  • 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