Friday, June 13, 2014

Installing and Configuring SendMail


During My application development i needed to send mail to our portal users.One of the option avalable for me to configure my own local system to as a MTA which can transfer email to destination smtp server which is my isp smtp server.

To make my system able to do that require job. We have installed the sendmail application to our local system on which my application is running by invoking the following command

$ apt-get install sendmail.

The command simply install the sendmail application to the system and make your system to work as a local smtp server. before getting your system to work fine, You have to configure your sendmail application to work as you expected. You just have to follow certain steps as i have mention below.


Step : 1
Edit /etc/mail/sendmail.mc file. and define the remote smtp server and it's domain by adding the following line of code

  define(`SMART_HOST', `yourremotesmtp.domain.in')dnl

Step : 2

To perform authentication to the remote smtp server. you have to create a authinfo file in the /etc/mail directory with the information regarding authentication to smtp server like your username and password. generally it will be your emailid and password to your mail service.

  create file /etc/mail/authinfo

  Add following information to the authinfo file

    AuthInfo: "U:youremail@domail.in" "P:password" "M:PLAIN"

  Add following section to /etc/mail/sendmail.mc file

        define(`confAUTH_OPTIONS', `A')dnl

        FEATURE(`authinfo',`hash -o /etc/mail/authinfo.db')dnl

  Enable your sendmail to route your email which has to be send by adding following lines

        MASQUERADE_AS(`yourdomainname.in')dnl

        MASQUERADE_DOMAIN(`yourdomainname.in')dnl

Step : 3

  Restart sendmail service.

  $service sendmail restart.

Step : 4

  Test your sendmail application by sending a test mail like.

        $ sendmail -v yourfriend@gmail.com.

        Test Email Message boby //new line

        . // terminate by dot(.)

No comments:

Post a Comment