-->
Previous Table of Contents Next


Chapter 40
Configuring Linux for Mail

by Tim Parker

In This Chapter
•   How email works
•   Configuring sendmail
•   Using sendmail version 8
•   smail
•   Modifying behavior of smail

There are two components to an email system on Linux: the mail user agent (called an MUA) that is your interface to the mail package on which you write and read mail and the underlying mail transport agent (called an MTA) that handles the sending and receiving of the mail.

There are two MTAs in common use with Linux called sendmail and smail, and literally dozens of MUAs available. There are probably more versions of email MTAs and MUAs available for Linux than any other software application, with the possible exception of editors. The most widely used email MTA system for Linux is sendmail, which is based on an email system developed at the University of California at Berkeley. There are several versions of sendmail available for Linux, each with slightly different capabilities. Another commonly used email system for Linux is smail, developed by Curt Noll and Ronald Karr. Again, there are several versions of smail currently available for Linux.

Because both sendmail and smail are supplied with most CD-ROM distributions of Linux, you may not be sure about which mail system you should use. For small installations (such as a typical Linux machine, either standalone or networked to others), either will work fine. In some ways, smail is slightly easier to configure and use, primarily because it is a more modern product. However, for larger systems or those with special configuration requirements, sendmail is more flexible and offers more configuration capabilities.

How Email Works

When you write a mail message using one of the mail user agent (MUA) user interface programs (such as Elm, Pine, or mail) on your Linux system, the application passes the message to the mail transfer agent (MTA), such as sendmail or smail. You can have several MTAs running (such as one package for LAN-based email delivery and another for UUCP delivery), although most systems use only one for convenience. The MUAs don’t actually pass the message to sendmail or smail but to a generic delivery transport called rmail, which is usually aliased to the specific MTA you want to use.

If the mail message is for someone on the local area network (or even the same machine), the MTA should be able to figure out this information from the address. MTAs must be able to understand aliasing, as well, in case you call machines, networks, or users by different names. If the message is for a remote system user, the MTA must be able to establish a connection to a mail machine somewhere along the route to the destination and transfer the mail. The connection can be either UUCP- or TCP-based. If the latter is used, a transfer protocol called Simple Mail Transfer Protocol (SMTP) is often employed. The MTA must also be able to handle problems with the delivery of mail, such as when the destination machine is unavailable or the user doesn’t exist. In this case, the mail is “bounced” or returned to the sender with an error message.

The routing of the mail messages to the destination is an important aspect of the MTA software and differs depending on which addressing scheme is used. For TCP-based addressing (usually using domain names), the default action is for an MTA to deliver messages to the destination machine based on the IP address and ignore the routing, leaving that to the IP software in the TCP/IP drivers.

Configuring sendmail

The most commonly used email program is sendmail which is supplied with most Linux versions. The sendmail system is extremely powerful and flexible, and because of these very attributes can, at times, be annoying and difficult to configure and administer. However, setting up sendmail and managing its use for most common email tasks is quite easy, as this chapter will show you. For those of you who have elected to use sendmail as your mail system, you will find this chapter provides enough information to satisfy all but the most complex networked system.

Because of the complexity of sendmail, it is often teamed with a utility called IDA, for a combined product often known as sendmail+IDA. IDA makes sendmail much easier to use and is the most common method of using sendmail with Linux. Indeed, with IDA in tow, sendmail becomes the easiest mail transport package available for Linux.


Tip:  
If your system doesn’t have sendmail+IDA but offers only sendmail, you may want to consider getting sendmail+IDA from an FTP or BBS site. The convenience sendmail+IDA offers far outweighs any hassles in obtaining the files. Some current Linux releases are offering sendmail version 8, which is usually not supplied with IDA. Check the FTP or BBS sites for more information about sendmail+IDA for this (and later) releases.

The sendmail system by itself (without IDA) is configured primarily through a file which is usually stored as /etc/sendmail.cf (although some systems place the file in /usr/lib/sendmail.cf or other locations). The language used in the sendmail.cf file is completely different from other configuration files and is very complex. To see for yourself, examine the sendmail.cf file and try to make sense of it!

The sendmail.cf file handles the default actions of the sendmail system. There are several other files involved in the configuration, too. These are:

  decnetxtable: converts generic addresses to DECnet addresses
  genericfrom: converts internal addresses into generic ones
  mailertable: defines any special treatment for remote hosts and domains
  pathtable: defines the UUCP paths to remote machines and domains
  uucpxtable: forces the delivery of UUCP mail from DNS addresses
  uucprelays: allows shortcuts to remote hosts
  xaliases: converts generic addresses to internal ones


Previous Table of Contents Next