5.3 The mail.local Delivery Agent

The mail.local program is a delivery agent designed to replace the normal delivery agent on many, but not all, versions of Unix. Read the file mail.local/README for up-to-date information about how to determine if your version of Unix will support mail.local.

On systems that support it, the mail.local program's chief advantage over your standard local delivery agent is that it can use LMTP for local delivery.[5] With LMTP, delivery of a single envelope to multiple recipients is more robust. LMTP is similar to SMTP, but it is designed for local delivery. It uses an acknowledged protocol that allows each recipient's status to be reported individually.

[5] LMTP is documented in RFC2033.

5.3.1 Build mail.local

Before building mail.local, you need to decide whether certain definitions should be in your m4 build file.[6]

[6] For all operating systems to which mail.local has been ported, all your m4 build file macros are already correct.

When porting to a new system, for example, the maillock(3) library routine for locking user mailboxes prior to delivery might be needed. If so, you will need to define two items in your m4 build file:

APPENDDEF(`conf_mail_local_ENVDEF', `-DMAILLOCK')
APPENDDEF(`conf_mail_local_LIBS', `-lmail')

Here, the first line tells the compiler to include support for maillock(3) as the means to lock local mailboxes for delivery. The second line tells the linker that the maillock(3) and related subroutines are located in the /usr/lib/libmail.a library.

Some versions of Unix require that the mailbox files be group-writable. You can tell if this is true for your site by changing to the directory where final delivery occurs and producing a long directory listing:

% cd /var/mail                   or /var/spool/mail or something similar 
% ls -l                          or ls -lg 
-rw-rw----  1 bob      mail        4618 Dec 13  2002 bob
-rw-rw----  1 amy      mail         798 Jan 24 14:43 amy

If these files are all owned by the same group (as mail in the earlier example), you will need to also define the following in your m4 build file:

APPENDDEF(`conf_mail_local_ENVDEF', `-DMAILGID=6')

Here, the gid (the 6) is the number associated with the group mail. This association can be found in the /etc/group file. MAILGID must be defined with a number, not with a name.

Some local delivery agents (such as those that run on the Solaris operating system) add a Content-Length: header (Content-Length:). You can get mail.local to do this by adding the following line to your m4 build file:


Once these decisions have been made, we are at last ready to build the mail.local program. The process is the same as it is for all the companion programs (see Section 5.1 for an overview of how to run the Build program). For example:

% ./Build -f ../../builds/oursite.m4

Once mail.local is built, you will find that it doesn't automatically install when you run "make install." This is intentional because the mail.local program should not be used on all systems. When you try to install, you might see this message:

NOTE: This version of mail.local is not suited for some operating
      systems such as HP-UX and Solaris.  Please consult the
      README file in the mail.local directory.  You can force
      the install using 'make force-install'.

If you wish to do so, you can force the installation by running the following command:[7]

[7] Note that this will not work from the top-level sendmail source directory. Instead, you must change into the mail.local directory first.

# make force-install

5.3.2 Set up sendmail.cf for mail.local

Before you can use the mail.local program you need to prepare your sendmail configuration file. The easiest way to do this is with the local_lmtp feature. In your mc configuration file, add the following line:


Note that this feature must precede the declaration of your local MAILER. It sets the F= flags for the local delivery agent to "PSXfmnz9" (F=), sets the T= DSN diagnostic code (U=) to "SMTP," and finally sets the A= delivery agent equate (A=) to run mail.local like this:

mail.local -l

The command-line argument -l (-l (lowercase L)) tells mail.local to speak LMTP with sendmail when delivering messages locally.

5.3.3 The mail.local Command-Line Switches

The mail.local program has a small set of command-line switches that modify its behavior. They are summarized in Table 5-4, and detailed in the sections that follow.

Table 5-4. The mail.local program's switches






Don't advertise 8BITMIME in LMTP



Mailbox over quota error is permanent, not temporary



Allow old-style -d execution



Specify mailbox database type



Specify the envelope sender



Store mail in user's home directory


-l (lowercase L)

Turn on LMTP mode



Specify the envelope sender (deprecated)

If you want to modify any of the command-line switches given to mail.local by sendmail, you can do so with the LOCAL_MAILER_ARGS mc configuration macro, which must follow the local_lmtp feature. For example:

define(`LOCAL_MAILER_ARGS', `mail.local -l -7')

Here, we have added a -7 to the default -l switch.

Not all switches are suitable for all installations. Review the following descriptions to decide which ones you need.

    Part I: Build and Install
    Chapter 2. Build and Install sendmail
    Chapter 4. Configure sendmail.cf with m4
    Part II: Administration
    Part III: The Configuration File