Share with others

To study a free and  open source software Send Mail
 
AIM
To study a free and  open source software Send Mail.
THEORY:

The basic components of the mail system are:

·         MTA : Mail Transport Agent (e.g., sendmail)
·         MUA : Mail User Agent (e.g., mutt)
·         MDA : Mail Delivery Agent (e.g., procmail)
When you compose a message, you typically do so from within your MUA. When you send the message, the MUA hands the message to the MTA. The MTA reads the envelope and directs it to the appropriate system where it is handled by the MDA for delivery.
Sendmail is a mail transfer agent (MTA) that is a well known project of the open source, free software and Unix communities, which is distributed both as free software and proprietary software.
A descendant of the original ARPANET delivermail application, Sendmail is a remarkably flexible program, supporting many kinds of mail transfer and delivery including the overwhelmingly popular SMTP. The original version of Sendmail was written by Eric Allman in the early 1980s at UC Berkeley, who had also written delivermail previously.
            The complexity of Sendmail has an upside: it is one of the most flexible and scalable MTAs. Out-of-the-box, Sendmail supports a variety of mail transfer protocols, including SMTP, ESMTP, DECnet’s mail11, HylaFax, QuickPage and UUCP. Additionally, Sendmail v8.12 as of September 2001 introduced support for Milter – external mail filtering programs/servers that can participate in each step of the SMTP conversation.
 Check your sendmail version
Sendmail is usually installed as /usr/sbin/sendmail or /usr/lib/sendmail. Some bizarre systems may even install it as /usr/etc/sendmail. If sendmail is running on your system, check the version by connecting to the SMTP port:
You can hit the escape sequence to drop back to the shell. Or simply type ‘quit’ and the server will close the connection.
INSTALLATION
Sendmail is pretty easy to build and install by hand. Most all Linux distributions include it, except Debian.
If you must compile and install it by hand, follow these steps:
1.      Download the source from ftp.sendmail.org.
      2.   Extract.     eg :      gzip -dc sendmail.8.12.7.tar.gz | tar -xvf -
      3.   Compile.   eg :      cd sendmail-8.12.7       
# Follow the steps in the INSTALL file, which walk you through compiling.                          #  Sendmail and setting up your configuration files.

The configuration files

Sendmail reads several different configuration files to figure out what it should be doing. Some of these files are explained below.

1. sendmail.mc

The sendmail.mc file is your main sendmail configuration file. Technically the program reads sendmail.cf and not sendmail.mc. Since sendmail.cf is not modifiable by humans, we write the mc file and run it through m4 to generate the sendmail.cf file. The configuration elements you put in your mc are actually m4 macros that get expanded to the real configuration elements for sendmail.

2. aliases

The aliases file maps email address aliases to something, usually a real user account. Sendmail doesn’t directly read the aliases file, it reads the aliases.db file. This is a BerkDB format of aliases.

3. access

This is a plain text file listing host access rights to the server.

.4. genericstable

This provides the outbound name to virtual address mapping, that is, the reverse of what the virtusertable does. For a proper virtual domain configuration, you will need to configure this file as well as the virtusertable (described below).This is a file that must be compiled to BerkDB format before sendmail can read it.

5. mailertable

This file contains custom domain routing information. You may wish to specifically route all email to addresses on the gatech.edu domain through a different SMTP server. This is the file where you define that.

6. relay-domains

This is a plain text file that lists individual hosts or ranges of hosts that are allowed to relay mail off your server. You’ll need this if you want to be able to use your mail server as an SMTP server when configuring a program like Evolution.

7. virtusertable

This file maps usernames from one hostname to a real user or another hostname. This file is used to set up virtual domains and virtual addresses.

8. local-host-names

This file lists the domain names that you are delivering mail on. This file sometimes differs in name across various distributions. Red Hat used to (or still does) call it sendmail.cw. Some simply call it locals. The format and purpose are the same, but the name may be different.

Writing a sendmail configuration file
Generating sendmail.mc

 It is a list of m4 macros and accompanying options. Generally there is one macro per line. Starting with the basic settings:
divert(0)
VERSIONID(My very own sendmail.mc')
OSTYPE(linux)
DOMAIN(generic)

VERSIONID, OSTYPE, and DOMAIN these are the m4 macro names. The values in the parentheses are the options for that macro.
We can add some features to the mail server.Features are added using the FEATURE macro.
eg.    FEATURE(access_db,
hash -o -T> TMPF         FEATURE(local_lmtp)
Lastly, setting some mailers for the system:
MAILER(local)
MAILER(smtp)

This configures sendmail for local mail operation and SMTP mail operation.
 Generating sendmail.cf

Generating the cf file for sendmail uses the m4 macro processor. Some distributions provide a Makefile in /etc/mail that automatically generates the configuration file. If you don’t have this, you’ll need to run the m4 command by hand. Here’s what you do:
m4 -D_CF_DIR=/usr/share/sendmail/cf \
/usr/share/sendmail/cf/m4/cf.m4 \
 sendmail.mc

This assumes your sendmail m4 directory is in /usr/share/sendmail/cf. It may be in a different location on your system. Sometimes you’ll find it in /usr/src/sendmail. Once you run the above command, you’ll have a ready-to-use sendmail.cf file.
Starting and Stopping sendmail
To start the server, run these commands:

/usr/sbin/sendmail -L sm-mta -bd -q25m
/usr/sbin/sendmail -L sm-msp-queue -Ac -q25m

This starts the sendmail MTA as well as the queue runner.
To stop sendmail, issue this command:

/sbin/killall sendmail

Sendmail reacts to signals in a normal manner and when it is sent SIGTERM it will shut itself down.
CONCLUSION:

We have successfully studied the free and  open source software Send Mail.


Share with others