Make your own free website on


What Sendmail Does
Role of DNS
Sendmail Configuration file
Sendmail configuration
Sendmail configurtaion with m4

What Sendmail Does :

Let's follow the path a message might take, starting after it's been composed and is handed to Sendmail by a Mail User Agent.

MUA Sends a Message . We've composed this simple message:

From: Richard Reich <>
Bcc: me
Subject: My Sendmail article

Please read the draft of my Sendmail article.  It will be in the
usual place by tonight.  Thanks.

This simple note is intended for a single recipient, with a blind carbon copy for my records. The MUA that composed it will start Sendmail and give it the message and the list of recipients.

Aliases . An alias is a convenient abbreviation for one or more full mailing addresses. That is, an alias can just be a nickname for an address or it can be the name of a list of recipients. Aliases can be maintained and expanded by a MUA or by Sendmail. Most MUAs keep alias information in their own version of an alias file. So, if you use, say, elm ordinarily, its alias file will not be available to Netscape when you use Netscape's ``Mail Document'' function. However, aliases maintained centrally by Sendmail will be recognized and expanded regardless of which MUA is used to compose a message.

There is an alias among the recipients of our example message: me. Sendmail will expand it and discover that the full address for ``me'' is the local mailbox ``richard''.

Handling Mail . The two recipient addresses are examined by Sendmail. One is local (me) and the other ( is an address at a remote host.

The message must be transformed slightly to handle the ``Bcc:'' header properly. Blind copying requires that the primary recipients not be informed of the blind copy recipient. So Sendmail, after having added my address to its internal list of recipients, deletes the ``Bcc :'' header field from the message.

Local Delivery . Assuming Sendmail has been configured to use ``bin mail'' for local delivery, it directs this program to save a copy of the message in my mailbox.

Local delivery is not always so dull, however. A user can keep private aliases in the .forward file in their home directory. Mail intended for delivery to a user with such a file will go instead to the addresses listed in that file. Mail can even be delivered (as standard input) to a program you specify in the .forward file. (That's how automatic mail response is implemented sometimes.)

Remote Delivery . Returning to our example, Sendmail now has an address that it determines--by examining its format--is probably intended for a remote Internet recipient. For each remote recipient, Sendmail will call upon its domain name resolver to find out the Internet host to which the message should be sent (that is, a mail exchanger--MX--qu ery will be made). Then, to actually transfer the message, an SMTP session will be initiated with the MTA (perhaps another Sendmail) at each remote mail handling host. A failed transfer will result in the message being queued for later delivery.

The Sendmail daemon . Our sample message will be accepted by a Sendmail daemon on a remote host (the mail exchanger for The message will then go through Sendmail's handling process on the remote system (assuming it's running Sendmail). Presumably, the message will be delivered locally to the mailbox of the intended recipient. Alias processing, forwarding, or other kinds of required relaying, however, might result in the message being passed to still another transfer agent.

The Role of DNS

Sendmail uses the Domain Name System to help it deliver mail. Proper implementation of a domain's mail handling strategy requires that the configurations of both Sendmail and DNS be accurate and coordinated. If a message is to be sent to a non-local recipient, the domain name portion of the recipient's address must be examined to determine the host where the message should be sent.

First, Sendmail queries the local DNS resolver to find so-called ``Mail Exchange or MX records'' for the recipient's domain. For example, to decide where to send a message addressed to, Sendmail will look for MX records for the domain name The DNS resolver will return any MX records it finds, often more than one. In the event that the recipient domain has no MX records defined, Sendmail will query DNS for CNAME or A records to arrive at a possible mail exchanger host. Multiple MX records--each specifying an alternative mail-handling host--can be defined for a domain name. An MX record contains a preference field that ranks its mail exchanger host relative to others for the same domain name. (The preference field's value is like a golf score: lower numbers are preferred, w ith zero the best. The maximum value is 65535). A mail transfer agent is required to choose the most preferred mail-exchange host among those that are currently functioning. Given a choice among several equally preferred hosts, Sendmail will choose one at random.

Continuing with our example (sending a message to, the DNS resolver might return to Sendmail MX records for like the following (rendered here in the textual form used by BIND 's configuration file):    85676   IN    MX      10    85676   IN    MX      20
The fields here are the recipient domain name, the TTL (time-to-live value in seconds), the data class, the record type, the preference value and, finally, the mail exchange host.

The records define a preferred mail exchanger at and a less preferred one at This means that Sendmail will try to send the message to failing If it gets to goldengate, the Sendmail daemon there will make its own attempt to deliver the message. Unless tempo has recovered in time, goldengate also fails to relay the mail as we'll see below.

Then a crucial bit of special handling is invoked to avoid sending mail about pointlessly. Sendmail will not relay mail to a mail exchanger that has an equal or greater preference value than its own. As long as tempo is unreachable, goldengate won't be able to relay the message because it can't find any other acceptable host. It will queue the message to disk and try to deliver it later.

Thus it's crucial to get the MX records right. If your domain has an erroneous MX record in its DNS server configuration, your perfectly configured Sendmail daemon may never see an incoming message. Remote Sendmails (or other transfer agents) may not find out that your host handles mail at all!

The Sendmail Configuration File

The Sendmail configuration file, generally named , contains several classes of information that determine the behavior of Sendmail on a host system: With very few exceptions, all of these components of the original Sendmail configuration file are hidden by the m4-based configuration macro files (as we'll see below).

For a majority of Sendmail configurations, the m4 macros in the Sendmail distribution package will suffice. For instance, having mail from all local hosts ``masquerade'' as though it comes from domain is a configuration choice that has been foreseen in the Berkeley release--a one-line macro ( MASQUERADE_AS( domain ) ) takes care of numerous details, including adding rewriting rules. However, some of the original configuration elements, like the semantics of Sendmail options and the nuances of rewriting rule sets, must be understood in their full glory if customization is attempted beyond that already anticip ated by the existing m4 macros.

Sendmail Configuration

DNS Configuration:
First, you need to obtain the new domain name and set up name servers for that new domain:
    Choose an available domain name. In our example, we will use

    Establish two machines as primary and secondary name servers for your domain. Knowledge of how to do this is assumed; otherwise, the book DNS and BIND, 2nd Edition is highly recommended.

    Configure MX records for your domain (Note: CNAME records can not be used; see § 5.2.2 of RFC 1123 for details.) MX records are explained in the sendmail book, section 15.3, and how to configure them is explained in section 21.3. You have two options for MX records:

    After the name servers are setup, register your domain with the InterNIC. A good starting point is their Registration Services page.
Now that DNS is setup, it's time to set up sendmail.
    Download sendmail from FTP.Sendmail.ORG/pub/sendmail/. You will automatically be offered a short initial message which will indicate the current release.

    Build and install sendmail for your machine. In most cases, this consists of unpacking the distribution, reading the READ_ME and src/READ_ME files, and typing makesendmail in the src directory. You may have to edit to the Makefile in the obj.OSVersion created by makesendmail. After building the sendmail binary, you can install it with makesendmail install.

    Configure sendmail. This is where we go into detail.

      First, read the cf/README file thoroughly. It will give you instructions on creating a .mc file in the cf/cf directory. Your file will typically look something like:
      #  This file contains definitions for
      VERSIONID(`@(#)     1.0 ( 5/1/97')
      FEATURE(virtusertable, `dbm /etc/virtusertable')dnl
      Your actual OS will be substituted for solaris2. A typical cf/domain/ file that looks something like:
      #  This file contains the global definitions for
      VERSIONID(`@(#)   1.0 ( 5/1/97')
      It may have some other FEATURE()'s and define()'s as well. The virtual user table is the key to all of this. Note: if you built sendmail with NEWDB instead of NDBM, you will have to use hash instead of dbm in the above line.

      Generate your /etc/ file from your file:

      cd sendmail-VERSION/cf/cf
      m4 ../m4/cf.m4 > obj/
      cp obj/ /etc/
    Create the virtual user table. This is explained in detail in section 19.6.28 of the sendmail book; an overview is given here. The table is a database that maps virtual addresses into real addresses. You create a text file where each line has a key/value pair, separated by a TAB. For example:      jschmoe         jschmoe
    In this first example, the address will be mapped to the local user jschmoe, will be mapped to the remote user, and anything else coming in to will also go to jschmoe.      jschmoe    error:nouser No such user here     yourdomain-list
    In this second example, the address will be mapped to the local user jschmoe, the address will return the indicated error, the address will be mapped to the local user yourdomain-list (which you would use the aliases file to ultimately resolve) and every other user at will be mapped to a remote user of the same name at

    Build the virtual user table. If the above virtual user table text file is located at sourcefile, and you are using the dbm database type, then use the command:

    makemap dbm /etc/virtusertable < sourcefile
    This actually creates one or more non-text files (typically /etc/virtusertable.dir and /etc/virtusertable.pag, or /etc/virtusertable.db), but does not actually change /etc/virtusertable itself, so this is the recommended location for sourcefile.

    If you would like to reverse-map local users for out-bound mail, you will need to add support for the generics table to your .mc file:

    FEATURE(genericstable, `dbm /etc/genericstable')dnl
    And you will need to create /etc/genericstable which is like /etc/virtusertable above except the columns are reversed:
    Add your domain name to sendmail's class w. This is typically done by adding a line to /etc/ with the value of your domain name.

    Likewise, if you are using the genericstable, you should add any domains you wish to reverse-map to /etc/sendmail.cG.

    Restart or SIGHUP sendmail. Note that you do not need to restart sendmail when changing the virtual user or generics tables, only when changing /etc/ or class files such as /etc/

An extra step is required for hosts that are not connected full-time. As noted in the MX configuration section, if you are use another host to queue your mail until you connect, you will have to force delivery of queued mail on the other mail server. To accomplish this, you should run the script which comes in the contrib directory of the sendmail distribution: secondary-mx-host
At this point, you should be set, and people should be able to send e-mail to addresses However, you should test your configuration and make sure everything works as expected before announcing the new domain name and mail addresses for that domain. If things don't work as expected, you can test with sendmail's test mode:
sendmail -bt

 Sendmail Configuration With m4

The information contained here was encapsulated in HTML from the cf/README file of the Berkeley sendmail 8.7.5 source distribution. The navigatory links were added for convenience.



                Eric Allman <eric@CS.Berkeley.EDU>

                @(#)README      8.81 (Berkeley) 12/3/95

This document describes the sendmail configuration files being used
at Berkeley.  These use features in the new (R8) sendmail; they will
not work on other versions.

These configuration files are probably not as general as previous
versions, and don't handle as many of the weird cases automagically.
I was able to simplify by them for two reasons.  First, the network
has become more consistent -- for example, at this point, everyone
on the internet is supposed to be running a name server, so hacks to
handle NIC-registered hosts can go away.  Second, I assumed that a
subdomain would be running SMTP internally -- UUCP is presumed to be
a long-haul protocol.  I realize that this is not universal, but it
does describe the vast majority of sites with which I am familiar,
including those outside the US.

Of course, the downside of this is that if you do live in a weird
world, things are going to get weirder for you.  I'm sorry about that,
but at the time we at Berkeley had a problem, and it seemed like the
right thing to do.

This package requires a post-V7 version of m4; if you are running the
4.2bsd, SysV.2, or 7th Edition version, I suggest finding a friend with
a newer version.  You can m4-expand on their system, then run locally.
SunOS's /usr/5bin/m4 or BSD-Net/2's m4 both work.  GNU m4 version 1.1
also works.  Unfortunately, I'm told that the M4 on BSDI 1.0 doesn't
work -- you'll have to use a Net/2 or GNU version.

IF YOU DON'T HAVE A BERKELEY MAKE, don't despair!  Just run
"m4 ../m4/cf.m4 >" -- that should be all you need.
There is also a fairly crude (but functional) Makefile.dist that works
on the old version of make.

To get started, you may want to look at (for TCP-only
sites), (for UUCP-only sites), and (for
clusters of clients using a single mail host).  Others are versions
that we use at Berkeley, although not all are in current use.  For
example, ucbarpa has gone away, but I've left in because
it demonstrates some interesting techniques.

I'm not pretending that this README describes everything that these
configuration files can do; clever people can probably tweak them
to great effect.  But it should get you started.

***  BE SURE YOU CUSTOMIZE THESE FILES!  They have some         ***
***  Berkeley-specific assumptions built in, such as the name   ***
***  of our UUCP-relay.  You'll want to create your own domain  ***
***  description, and use that in place of domain/Berkeley.m4.  ***


Configuration files are contained in the subdirectory "cf", with a
suffix ".mc".  They must be run through "m4" to produce a ".cf" file.
You must pre-load "cf.m4":

        m4 ${CFDIR}/m4/cf.m4 >

where ${CFDIR} is the root of the cf directory and is the
name of your configuration file.  If you are running a version of M4
that understands the __file__ builtin (versions of GNU m4 >= 0.75 do
this, but the versions distributed with 4.4BSD and derivatives do not)
or the -I flag (ditto), then ${CFDIR} can be in an arbitrary directory.
For "traditional" versions, ${CFDIR} ***MUST*** be "..", or you MUST
use -D_CF_DIR_=/path/to/cf/dir/ -- note the trailing slash!  For example:

        m4 -D_CF_DIR_=${CFDIR}/ ${CFDIR}/m4/cf.m4 >

Let's examine a typical .mc file:

        # Copyright (c) 1983 Eric P. Allman
        # Copyright (c) 1988, 1993
        #       The Regents of the University of California.  All rights reserved.
        # Redistribution and use in source and binary forms, with or without
        # modification, are permitted provided that the following conditions
        # are met:
        # 1. Redistributions of source code must retain the above copyright
        #    notice, this list of conditions and the following disclaimer.
        # 2. Redistributions in binary form must reproduce the above copyright
        #    notice, this list of conditions and the following disclaimer in
        #    the documentation and/or other materials provided with the
        #    distribution.
        # 3. All advertising materials mentioning features or use of this
        #    software #    must display the following acknowledgement:
        #       This product includes software developed by the University of
        #       California, Berkeley and its contributors.
        # 4. Neither the name of the University nor the names of its
        #    contributors may be used to endorse or promote products derived
        #    from this software without specific prior written permission.

        #  This is a Berkeley-specific configuration file for HP-UX 9.x.
        #  It applies only the the Computer Science Division at Berkeley,
        #  and should not be used elsewhere.   It is provided on the sendmail
        #  distribution as a sample only.  To create your own configuration
        #  file, create an appropriate domain file in ../domain, change the
        #  `DOMAIN' macro below to reference that file, and copy the result
        #  to a name of your own choosing.

The divert(-1) will delete the crud in the resulting output file.
The copyright notice can be replace by whatever your lawyers require;
our lawyers require the one that I've included in my files.  A copyleft
is a copyright by another name.  The divert(0) restores regular output.

        VERSIONID(`<SCCS or RCS version id>')

VERSIONID is a macro that stuffs the version information into the
resulting file.  We use SCCS; you could use RCS, something else, or
omit it completely.  This is not the same as the version id included
in SMTP greeting messages -- this is defined in m4/version.m4.


You must specify an OSTYPE to properly configure things such as the
pathname of the help and status files, the flags needed for the local
mailer, and other important things.  If you omit it, you will get an
error when you try to build the configuration.  Look at the ostype
directory for the list of known operating system types.


This example is specific to the Computer Science Division at Berkeley.
You can use "DOMAIN(generic)" to get a sufficiently bland definition
that may well work for you, or you can create a customized domain
definition appropriate for your environment.


These describe the mailers used at the default CS site site.  The
local mailer is always included automatically.  Beware MAILER
declarations should always be last in the configuration file, and
MAILER(smtp) should always precede MAILER(uucp).

One word of warning:  M4 macros are expanded even in lines that appear
to be comments.  For example, if you have

        # See FEATURE(foo) above

it will not do what you expect, because the FEATURE(foo) will be
expanded.  This also applies to

        # And then define the $X macro to be the return address

because ``define'' is an M4 keyword.  If you want to use them, surround
them with directed quotes, `like this'.

[Return to contents]


You MUST define an operating system environment, or the configuration
file build will puke.  There are several environments available; look
at the "ostype" directory for the current list.  This macro changes
things like the location of the alias file and queue directory.  Some
of these files are identical to one another.

It is IMPERATIVE that the OSTYPE occur before any MAILER definitions.
In general, the OSTYPE macro should go immediately after any version
information, and MAILER definitions should always go last.

Operating system definitions are usually easy to write.  They may define
the following variables (everything defaults, so an ostype file may be
empty).  Unfortunately, the list of configuration-supported systems is
not as broad as the list of source-supported systems, since many of
the source contributors do not include corresponding ostype files.

ALIAS_FILE              [/etc/aliases] The location of the text version
                        of the alias file(s).  It can be a comma-separated
                        list of names (but be sure you quote values with
                        commas in them -- for example, use
                                define(`ALIAS_FILE', `a,b')
                        to get "a" and "b" both listed as alias files;
                        otherwise the define() primitive only sees "a").
HELP_FILE               [/usr/lib/sendmail.hf] The name of the file
                        containing information printed in response to
                        the SMTP HELP command.
QUEUE_DIR               [/var/spool/mqueue] The directory containing
                        queue files.
STATUS_FILE             [/etc/] The file containing status
LOCAL_MAILER_PATH       [/bin/mail] The program used to deliver local mail.
LOCAL_MAILER_FLAGS      [rmn] The flags used by the local mailer.  The
                        flags lsDFM are always included.
LOCAL_MAILER_ARGS       [mail -d $u] The arguments passed to deliver local
LOCAL_MAILER_MAX        [undefined] If defined, the maximum size of local
                        mail that you are willing to accept.
LOCAL_MAILER_CHARSET    [undefined] If defined, messages containing 8-bit data
                        that ARRIVE from an address that resolves to the
                        local mailer and which are converted to MIME will be
                        labelled with this character set.
LOCAL_SHELL_PATH        [/bin/sh] The shell used to deliver piped email.
LOCAL_SHELL_FLAGS       [eu] The flags used by the shell mailer.  The
                        flags lsDFM are always included.
LOCAL_SHELL_ARGS        [sh -c $u] The arguments passed to deliver "prog"
LOCAL_SHELL_DIR         [$z:/] The directory search path in which the
                        shell should run.
USENET_MAILER_PATH      [/usr/lib/news/inews] The name of the program
                        used to submit news.
USENET_MAILER_FLAGS     [rlsDFMmn] The mailer flags for the usenet mailer.
USENET_MAILER_ARGS      [-m -h -n] The command line arguments for the
                        usenet mailer.
USENET_MAILER_MAX       [100000] The maximum size of messages that will
                        be accepted by the usenet mailer.
SMTP_MAILER_FLAGS       [undefined] Flags added to SMTP mailer.  Default
                        flags are `mDFMUX' for all SMTP-based mailers; the
                        "esmtp" mailer adds `a' and "smtp8" adds `8'.
SMTP_MAILER_MAX         [undefined] The maximum size of messages that will
                        be transported using the smtp, smtp8, or esmtp
SMTP_MAILER_ARGS        [IPC $h] The arguments passed to the smtp mailer.
                        About the only reason you would want to change this
                        would be to change the default port.
ESMTP_MAILER_ARGS       [IPC $h] The arguments passed to the esmtp mailer.
SMTP8_MAILER_ARGS       [IPC $h] The arguments passed to the smtp8 mailer.
RELAY_MAILER_ARGS       [IPC $h] The arguments passed to the relay mailer.
SMTP_MAILER_CHARSET     [undefined] If defined, messages containing 8-bit data
                        that ARRIVE from an address that resolves to one of
                        the SMTP mailers and which are converted to MIME will
                        be labelled with this character set.
UUCP_MAILER_FLAGS       [undefined] Flags added to UUCP mailer.  Default
                        flags are `DFMhuU' (and `m' for uucp-new mailer,
                        minus `U' for uucp-dom mailer).
UUCP_MAILER_ARGS        [uux - -r -z -a$g -gC $h!rmail ($u)] The arguments
                        passed to the UUCP mailer.
UUCP_MAILER_MAX         [100000] The maximum size message accepted for
                        transmission by the UUCP mailers.
UUCP_MAILER_CHARSET     [undefined] If defined, messages containing 8-bit data
                        that ARRIVE from an address that resolves to one of
                        the UUCP mailers and which are converted to MIME will
                        be labelled with this character set.
FAX_MAILER_PATH         [/usr/local/lib/fax/mailfax] The program used to
                        submit FAX messages.
FAX_MAILER_MAX          [100000] The maximum size message accepted for
                        transmission by FAX.
POP_MAILER_PATH         [/usr/lib/mh/spop] The pathname of the POP mailer.
POP_MAILER_FLAGS        [Penu] Flags added to POP mailer.  Flags "lsDFM"
                        are always added.
POP_MAILER_ARGS         [pop $u] The arguments passed to the POP mailer.
PROCMAIL_MAILER_FLAGS   [Shu] Flags added to Procmail mailer.  Flags
                        ``DFMmn'' are always set.
PROCMAIL_MAILER_ARGS    [procmail -m $h $f $u] The arguments passed to
                        the Procmail mailer.
PROCMAIL_MAILER_MAX     [undefined] If set, the maximum size message that
                        will be accepted by the procmail mailer.
MAIL11_MAILER_PATH      [/usr/etc/mail11] The path to the mail11 mailer.
MAIL11_MAILER_FLAGS     [nsFx] Flags for the mail11 mailer.
MAIL11_MAILER_ARGS      [mail11 $g $x $h $u] Arguments passed to the mail11
PH_MAILER_PATH          [/usr/local/etc/phquery] The path to the phquery
PH_MAILER_FLAGS         [ehmu] Flags for the phquery mailer.

PH_MAILER_ARGS          [phquery -- $u] -- arguments to the phquery mailer.
CYRUS_MAILER_FLAGS      [A5@] The flags used by the cyrus mailer.  The
                        flags lsDFMnP are always included.
CYRUS_MAILER_PATH       [/usr/cyrus/bin/deliver] The progam used to deliver
                        cyrus mail.
CYRUS_MAILER_ARGS       [deliver -e -m $h -- $u] The arguments passed
                        to deliver cyrus mail.
CYRUS_BB_MAILER_FLAGS   [undefined] The flags used by the cyrusbb
                        mailer. The flags lsDFMnP are always included.
CYRUS_BB_MAILER_ARGS    [deliver -e -m $u] The arguments passed
                        to deliver cyrusbb mail.

[Return to contents]


You will probably want to collect domain-dependent defines into one
file, referenced by the DOMAIN macro.  For example, our Berkeley
domain file includes definitions for several internal distinguished

UUCP_RELAY      The host that will accept UUCP-addressed email.
                If not defined, all UUCP sites must be directly
BITNET_RELAY    The host that will accept BITNET-addressed email.
                If not defined, the .BITNET pseudo-domain won't work.
DECNET_RELAY    The host that will accept DECNET-addressed email.
                If not defined, the .DECNET pseudo-domain and addresses
                of the form node::user will not work.
FAX_RELAY       The host that will accept mail to the .FAX pseudo-domain.
                The "fax" mailer overrides this value.
LOCAL_RELAY     DEPRECATED.  The site that will handle unqualified
                names -- that is, names with out an @domain extension.
                If not set, they are assumed to belong on this machine.
                This allows you to have a central site to store a
                company- or department-wide alias database.  This
                only works at small sites, and only with some user
LUSER_RELAY     The site that will handle lusers -- that is, apparently
                local names that aren't local accounts or aliases.

Any of these can be either ``mailer:hostname'' (in which case the
mailer is the internal mailer name, such as ``uucp-new'' and the hostname
is the name of the host as appropriate for that mailer) or just a
``hostname'', in which case a default mailer type (usually ``relay'',
a variant on SMTP) is used.  WARNING: if you have a wildcard MX
record matching your domain, you probably want to define these to
have a trailing dot so that you won't get the mail diverted back
to yourself.

The domain file can also be used to define a domain name, if needed
(using "DD<domain>") and set certain site-wide features.  If all hosts
at your site masquerade behind one email name, you could also use

You do not have to define a domain -- in particular, if you are a
single machine sitting off somewhere, it is probably more work than
it's worth.  This is just a mechanism for combining "domain dependent
knowledge" into one place.

[Return to contents]


There are fewer mailers supported in this version than the previous
version, owing mostly to a simpler world.  As a general rule, put the
MAILER definitions last in your .mc file, and always put MAILER(smtp)
before MAILER(uucp) -- several features and definitions will modify
the definition of mailers, and the smtp mailer modifies the UUCP

local           The local and prog mailers.  You will almost always
                need these; the only exception is if you relay ALL
                your mail to another site.  This mailer is included

smtp            The Simple Mail Transport Protocol mailer.  This does
                not hide hosts behind a gateway or another other
                such hack; it assumes a world where everyone is
                running the name server.  This file actually defines
                four mailers: "smtp" for regular (old-style) SMTP to
                other servers, "esmtp" for extended SMTP to other
                servers, "smtp8" to do SMTP to other servers without
                converting 8-bit data to MIME (essentially, this is
                your statement that you know the other end is 8-bit
                clean even if it doesn't say so), and "relay" for
                transmission to our RELAY_HOST, LUSER_RELAY, or

uucp            The Unix-to-Unix Copy Program mailer.  Actually, this
                defines two mailers, "uucp-old" (a.k.a. "uucp") and
                "uucp-new" (a.k.a. "suucp").  The latter is for when you
                know that the UUCP mailer at the other end can handle
                multiple recipients in one transfer.  If the smtp mailer
                is also included in your configuration, two other mailers
                ("uucp-dom" and "uucp-uudom") are also defined [warning:
                you MUST specify MAILER(smtp) before MAILER(uucp)].  When you
                include the uucp mailer, sendmail looks for all names in
                the $=U class and sends them to the uucp-old mailer; all
                names in the $=Y class are sent to uucp-new; and all
                names in the $=Z class are sent to uucp-uudom.  Note that
                this is a function of what version of rmail runs on
                the receiving end, and hence may be out of your control.
                See the section below describing UUCP mailers in more

usenet          Usenet (network news) delivery.  If this is specified,
                an extra rule is added to ruleset 0 that forwards all
                local email for users named ``group.usenet'' to the
                ``inews'' program.  Note that this works for all groups,
                and may be considered a security problem.

fax             Facsimile transmission.  This is experimental and based
                on Sam Leffler's FlexFAX software.  For more information,
                see below.

pop             Post Office Protocol.

procmail        An interface to procmail (does not come with sendmail).
                This is designed to be used in mailertables.  For example,
                a common question is "how do I forward all mail for a given
                domain to a single person?".  If you have this mailer
                defined, you could set up a mailertable reading:


                with the file /etc/procmailrcs/ reading:

                        :0      # forward mail for
                        ! -oi -f $1

                This would arrange for (anything) to be sent
                to  Within the procmail script, $1 is
                the name of the sender and $2 is the name of the recipient.
                If you use this with FEATURE(local_procmail), the FEATURE
                should be listed first.

mail11          The DECnet mail11 mailer, useful only if you have the mail11
                program from (and
                DECnet, of course).  This is for Phase IV DECnet support;
                if you have Phase V at your site you may have additional

phquery         The phquery program.  This is somewhat counterintuitively
                referenced as the "ph" mailer internally.  It can be used
                to do CCSO name server lookups.  The phquery program, which
                this mailer uses, is distributed with the ph client.

cyrus           The cyrus and cyrusbb mailers.  The cyrus mailer delivers to
                a local cyrus user.  this mailer can make use of the
                "" syntax; it will deliver the mail to
                the user's "detail" mailbox if the mailbox's ACL permits.
                The cyrusbb mailer delivers to a system-wide cyrus mailbox
                if the mailbox's ACL permits.

The local mailer accepts addresses of the form "user+detail", where
the "+detail" is not used for mailbox matching but is available
to certain local mail programs (in particular, see FEATURE(local_procmail)).
For example, "eric", "eric+sendmail", and "eric+sww" all indicate
the same user, but additional arguments <null>, "sendmail", and "sww"
may be provided for use in sorting mail.

[Return to contents]


Special features can be requested using the "FEATURE" macro.  For
example, the .mc line:


tells sendmail that you want to have it read an /etc/
file to get values for class $=w.  The FEATURE may contain a single
optional parameter -- for example:

        FEATURE(mailertable, dbm /usr/lib/mailertable)

Available features are:

use_cw_file     Read the file /etc/ file to get alternate
                names for this host.  This might be used if you were
                on a host that MXed for a dynamic set of other
                hosts.  If the set is static, just including the line
                "Cw<name1> <name2> ..." is probably superior.
                The actual filename can be overridden by redefining

use_ct_file     Read the file /etc/sendmail.ct file to get the names
                of users that will be ``trusted'', that is, able to
                set their envelope from address using -f without
                generating a warning message.
                The actual filename can be overridden by redefining

redirect        Reject all mail addressed to "address.REDIRECT" with
                a ``551 User not local; please try <address>'' message.
                If this is set, you can alias people who have left
                to their new address with ".REDIRECT" appended.

nouucp          Don't do anything special with UUCP addresses at all.

nocanonify      Don't pass addresses to $[ ... $] for canonification.
                This would generally only be used by sites that only
                act as mail gateways or which have user agents that do
                full canonification themselves.  You may also want to
                use "define(`confBIND_OPTS',`-DNSRCH -DEFNAMES')" to
                turn off the usual resolver options that do a similar

stickyhost      If set, email sent to "" are marked
                as "sticky" -- that is, the local addresses aren't
                matched against UDB and don't go through ruleset 5.
                This is used if you want a set up where "user" is
                not necessarily the same as "", e.g.,
                to make a distinct domain-wide namespace.  Prior to
                8.7 this was the default, and notsticky was used to
                turn this off.

mailertable     Include a "mailer table" which can be used to override
                routing for particular domains.  The argument of the
                FEATURE may be the key definition.  If none is specified,
                the definition used is:
                        hash -o /etc/mailertable
                Keys in this database are fully qualified domain names
                or partial domains preceded by a dot -- for example,
                "vangogh.CS.Berkeley.EDU" or ".CS.Berkeley.EDU".
                Values must be of the form:
                where "mailer" is the internal mailer name, and "domain"
                is where to send the message.  These maps are not
                reflected into the message header.

domaintable     Include a "domain table" which can be used to provide
                domain name mapping.  Use of this should really be
                limited to your own domains.  It may be useful if you
                change names (e.g., your company changes names from
       to  The argument of the
                FEATURE may be the key definition.  If none is specified,
                the definition used is:
                        hash -o /etc/domaintable
                The key in this table is the domain name; the value is
                the new (fully qualified) domain.  Anything in the
                domaintable is reflected into headers; that is, this
                is done in ruleset 3.

bitdomain       Look up bitnet hosts in a table to try to turn them into
                internet addresses.  The table can be built using the
                bitdomain program contributed by John Gardiner Myers.
                The argument of the FEATURE may be the key definition; if
                none is specified, the definition used is:
                        hash -o /etc/bitdomain.db
                Keys are the bitnet hostname; values are the corresponding
                internet hostname.

uucpdomain      Similar feature for UUCP hosts.  The default map definition
                        hash -o /etc/uudomain.db
                At the moment there is no automagic tool to build this

                Include the local host domain even on locally delivered
                mail.  Normally it is not added unless it is already

allmasquerade   If masquerading is enabled (using MASQUERADE_AS), this
                feature will cause recipient addresses to also masquerade
                as being from the masquerade host.  Normally they get
                the local hostname.  Although this may be right for
                ordinary users, it can break local aliases.  For example,
                if you send to "localalias", the originating sendmail will
                find that alias and send to all members, but send the
                message with "To: localalias@masqueradehost".  Since that
                alias likely does not exist, replies will fail.  Use this
                feature ONLY if you can guarantee that the ENTIRE
                namespace on your masquerade host supersets all the
                local entries.

nodns           We aren't running DNS at our site (for example,
                we are UUCP-only connected).  It's hard to consider
                this a "feature", but hey, it had to go somewhere.

nullclient      This is a special case -- it creates a stripped down
                configuration file containing nothing but support for
                forwarding all mail to a central hub via a local
                SMTP-based network.  The argument is the name of that
                The only other feature that should be used in conjunction
                with this one is "nocanonify" (this causes addresses to
                be sent unqualified via the SMTP connection; normally
                they are qualifed with the masquerade name, which
                defaults to the name of the hub machine).  No mailers
                should be defined.  No aliasing or forwarding is done.

local_procmail  Use procmail as the local mailer.  This mailer can
                make use of the "" syntax;
                normally the +indicator is just tossed, but by default
                it is passed as the -a argument to procmail.  The
                argument to this feature is the pathname of procmail,
                which defaults to /usr/local/bin/procmail.

bestmx_is_local Accept mail as though locally addressed for any host that
                lists us as the best possible MX record.  This generates
                additional DNS traffic, but should be OK for low to
                medium traffic hosts.  THIS FEATURE IS FUNDAMENTALLY
                INCOMPATIBLE WITH WILDCARD MX RECORDS!!!  If you have
                a wildcard MX record that matches your domain, you
                cannot use this feature.

smrsh           Use the SendMail Restricted SHell (smrsh) provided
                with the distribution instead of /bin/sh for mailing
                to programs.  This improves the ability of the local
                system administrator to control what gets run via
                e-mail.  If an argument is provided it is used as the
                pathname to smrsh; otherwise, /usr/local/etc/smrsh is

[Return to contents]


Some things just can't be called features.  To make this clear,
they go in the hack subdirectory and are referenced using the HACK
macro.  These will tend to be site-dependent.  The release
includes the Berkeley-dependent "cssubdomain" hack (that makes
sendmail accept local names in either Berkeley.EDU or CS.Berkeley.EDU;
this is intended as a short-term aid while we move hosts into

[Return to contents]


    * This section is really obsolete, and is preserved *
    * only for back compatibility.  You should plan on  *
    * using mailertables for new installations.   In    *
    * particular, it doesn't work for the newer forms   *
    * of UUCP mailers, such as uucp-uudom.              *

Complex sites will need more local configuration information, such as
lists of UUCP hosts they speak with directly.  This can get a bit more
tricky.  For an example of a "complex" site, see cf/

If your host is known by several different names, you need to augment
the $=w class.  This is a list of names by which you are known, and
anything sent to an address using a host name in this list will be
treated as local mail.  You can do this in two ways: either create
the file /etc/ containing a list of your aliases (one per
line), and use ``FEATURE(use_cw_file)'' in the .mc file, or add the


at the end of that file.  See the ``'' file for an example.
Be sure you use the fully-qualified name of the host, rather than a
short name.

The SITECONFIG macro allows you to indirectly reference site-dependent
configuration information stored in the siteconfig subdirectory.  For
example, the line

        SITECONFIG(uucp.ucbvax, ucbvax, U)

reads the file uucp.ucbvax for local connection information.  The
second parameter is the local name (in this case just "ucbvax" since
it is locally connected, and hence a UUCP hostname).  The third
parameter is the name of both a macro to store the local name (in
this case, $U) and the name of the class (e.g., $=U) in which to store
the host information read from the file.  Another SITECONFIG line reads

        SITECONFIG(uucp.ucbarpa, ucbarpa.Berkeley.EDU, W)

This says that the file uucp.ucbarpa contains the list of UUCP sites
connected to ucbarpa.Berkeley.EDU.  The $=W class will be used to
store this list, and $W is defined to be ucbarpa.Berkeley.EDU, that
is, the name of the relay to which the hosts listed in uucp.ucbarpa
are connected.  [The machine ucbarpa is gone now, but I've left
this out-of-date configuration file around to demonstrate how you
might do this.]

Note that the case of SITECONFIG with a third parameter of ``U'' is
special; the second parameter is assumed to be the UUCP name of the
local site, rather than the name of a remote site, and the UUCP name
is entered into $=w (the list of local hostnames) as $U.UUCP.

The siteconfig file (e.g., siteconfig/uucp.ucbvax.m4) contains nothing
more than a sequence of SITE macros describing connectivity.  For

        SITE(sgi olympus)

The second example demonstrates that you can use two names on the
same line; these are usually aliases for the same host (or are at
least in the same company).

[Return to contents]


It's hard to get UUCP mailers right because of the extremely ad hoc
nature of UUCP addressing.  These config files are really designed
for domain-based addressing, even for UUCP sites.

There are four UUCP mailers available.  The choice of which one to
use is partly a matter of local preferences and what is running at
the other end of your UUCP connection.  Unlike good protocols that
define what will go over the wire, UUCP uses the policy that you
should do what is right for the other end; if they change, you have
to change.  This makes it hard to do the right thing, and discourages
people from updating their software.  In general, if you can avoid
UUCP, please do.

The major choice is whether to go for a domainized scheme or a
non-domainized scheme.  This depends entirely on what the other
end will recognize.  If at all possible, you should encourage the
other end to go to a domain-based system -- non-domainized addresses
don't work entirely properly.

The four mailers are:

    uucp-old (obsolete name: "uucp")
        This is the oldest, the worst (but the closest to UUCP) way of
        sending messages accros UUCP connections.  It does bangify
        everything and prepends $U (your UUCP name) to the sender's
        address (which can already be a bang path itself).  It can
        only send to one address at a time, so it spends a lot of
        time copying duplicates of messages.  Avoid this if at all

    uucp-new (obsolete name: "suucp")
        The same as above, except that it assumes that in one rmail
        command you can specify several recipients.  It still has a
        lot of other problems.

        This UUCP mailer keeps everything as domain addresses.
        Basically, it uses the SMTP mailer rewriting rules.  This mailer
        is only included if MAILER(smtp) is also specified.

        Unfortunately, a lot of UUCP mailer transport agents require
        bangified addresses in the envelope, although you can use
        domain-based addresses in the message header.  (The envelope
        shows up as the From_ line on UNIX mail.)  So....

        This is a cross between uucp-new (for the envelope addresses)
        and uucp-dom (for the header addresses).  It bangifies the
        envelope sender (From_ line in messages) without adding the
        local hostname, unless there is no host name on the address
        at all (e.g., "wolf") or the host component is a UUCP host name
        instead of a domain name ("somehost!wolf" instead of
        "some.dom.ain!wolf").  This is also included only if MAILER(smtp)
        is also specified.


We are on host (UUCP host name "grasp").  The
following summarizes the sender rewriting for various mailers.

Mailer          sender          rewriting in the envelope
------          ------          -------------------------
uucp-{old,new}  wolf            grasp!wolf
uucp-dom        wolf  
uucp-uudom      wolf  !wolf

uucp-{old,new}     grasp!!wolf

uucp-{old,new}  somehost!wolf   grasp!somehost!wolf
uucp-dom        somehost!wolf   somehost!
uucp-uudom      somehost!wolf!somehost!wolf

If you are using one of the domainized UUCP mailers, you really want
to convert all UUCP addresses to domain format -- otherwise, it will
do it for you (and probably not the way you expected).  For example,
if you have the address foo!bar!baz (and you are not sending to foo),
the heuristics will add the or to
this address.  However, if you map foo to first, it
will not add the local hostname.  You can do this using the uucpdomain

[Return to contents]


For more complex configurations, you can define special rules.
The macro LOCAL_RULE_3 introduces rules that are used in canonicalizing
the names.  Any modifications made here are reflected in the header.

A common use is to convert old UUCP addreses to SMTP addresses using
the UUCPSMTP macro.  For example:


will cause addresses of the form "decvax!user" and "research!user"
to be converted to "" and ""

This could also be used to look up hosts in a database map:

        R$* < @ $+ > $*         $: $1 < @ $(hostmap $2 $) > $3

This map would be defined in the LOCAL_CONFIG portion, as shown below.

Similarly, LOCAL_RULE_0 can be used to introduce new parsing rules.
For example, new rules are needed to parse hostnames that you accept
via MX records.  For example, you might have:

        R$+ <@ host.dom.ain.>   $#uucp $@ cnmat $: $1 < @ host.dom.ain.>

You would use this if you had installed an MX record for cnmat.Berkeley.EDU
pointing at this host; this rule catches the message and forwards it on
using UUCP.

You can also tweak rulesets 1 and 2 using LOCAL_RULE_1 and LOCAL_RULE_2.
These rulesets are normally empty.

A similar macro is LOCAL_CONFIG.  This introduces lines added after the
boilerplate option setting but before rulesets, and can be used to
declare local database maps or whatever.  For example:

        Khostmap hash /etc/hostmap.db
        Kyplocal nis -m hosts.byname

[Return to contents]


You can have your host masquerade as another using


This causes outgoing SMTP mail to be labeled as coming from the
indicated domain, rather than $j.  One normally masquerades as one
of one's own subdomains (for example, it's unlikely that I would
choose to masquerade as an MIT site).

The masquerade name is not normally canonified, so it is important
that it be your One True Name, that is, fully qualified and not a

Normally the only addresses that are masqueraded are those that come
from this host (that is, are either unqualified or in $=w, the list
of local domain names).  You can augment this list using


The effect of this is that although mail to user@otherhost.domain
will not be delivered locally, any mail including any user@otherhost.domain
will, when relayed, be rewritten to have the MASQUERADE_AS address.
This can be a space-separated list of names.

If these names are in a file, you can use


to read the list of names from the indicated file.

Normally only header addresses are masqueraded.  If you want to
masquerade the envelope as well, use


There are always users that need to be "exposed" -- that is, their
internal site name should be displayed instead of the masquerade name.
Root is an example.  You can add users to this list using


This adds users to class E; you could also use something like


You can also arrange to relay all unqualified names (that is, names
without @host) to a relay host.  For example, if you have a central
email server, you might relay to that host so that users don't have
to have .forward files or aliases.  You can do this using

        define(`LOCAL_RELAY', mailer:hostname)

The ``mailer:'' can be omitted, in which case the mailer defaults to
"smtp".  There are some user names that you don't want relayed, perhaps
because of local aliases.  A common example is root, which may be
locally aliased.  You can add entries to this list using


This adds users to class L; you could also use something like


If you want all incoming mail sent to a centralized hub, as for a
shared /var/spool/mail scheme, use

        define(`MAIL_HUB', mailer:hostname)

Again, ``mailer:'' defaults to "smtp".  If you define both LOCAL_RELAY
and MAIL_HUB _AND_ you have FEATURE(stickyhost), unqualified names will
be sent to the LOCAL_RELAY and other local names will be sent to MAIL_HUB.
Names in $=L will be delivered locally, so you MUST have aliases or
.forward files for them.

For example, if are on machine mastodon.CS.Berkeley.EDU and you have
FEATURE(stickyhost), the following combinations of settings will have the
indicated effects:

email sent to....       eric                      eric@mastodon.CS.Berkeley.EDU

LOCAL_RELAY set to      mail.CS.Berkeley.EDU      (delivered locally)
mail.CS.Berkeley.EDU      (no local aliasing)       (aliasing done)

MAIL_HUB set to         mammoth.CS.Berkeley.EDU   mammoth.CS.Berkeley.EDU
mammoth.CS.Berkeley.EDU   (aliasing done)           (aliasing done)

Both LOCAL_RELAY and    mail.CS.Berkeley.EDU      mammoth.CS.Berkeley.EDU
MAIL_HUB set as above     (no local aliasing)       (aliasing done)

If you do not have FEATURE(stickyhost) set, then LOCAL_RELAY and
MAIL_HUB act identically, with MAIL_HUB taking precedence.

If you want all outgoing mail to go to a central relay site, define
SMART_HOST as well.  Briefly:

        LOCAL_RELAY applies to unqualifed names (e.g., "eric").
        MAIL_HUB applies to names qualified with the name of the
                local host (e.g., "eric@mastodon.CS.Berkeley.EDU").
        SMART_HOST applies to names qualified with other hosts.

However, beware that other relays (e.g., UUCP_RELAY, BITNET_RELAY,
DECNET_RELAY, and FAX_RELAY) take precedence over SMART_HOST, so if you
really want absolutely everything to go to a single central site you will
need to unset all the other relays -- or better yet, find or build a
minimal config file that does this.

[Return to contents]


These configuration files are designed primarily for use by SMTP-based
sites.  I don't pretend that they are well tuned for UUCP-only or
UUCP-primarily nodes (the latter is defined as a small local net
connected to the rest of the world via UUCP).  However, there is one
hook to handle some special cases.

You can define a ``smart host'' that understands a richer address syntax

        define(`SMART_HOST', mailer:hostname)

In this case, the ``mailer:'' defaults to "relay".  Any messages that
can't be handled using the usual UUCP rules are passed to this host.

If you are on a local SMTP-based net that connects to the outside
world via UUCP, you can use LOCAL_NET_CONFIG to add appropriate rules.
For example:

        define(`SMART_HOST', suucp:uunet)
        R$* < @ $* .$m. > $*    $#smtp $@ $2.$m. $: $1 < @ $2.$m. > $3

This will cause all names that end in your domain name ($m) via
SMTP; anything else will be sent via suucp (smart UUCP) to uunet.
If you have FEATURE(nocanonify), you may need to omit the dots after
the $m.  If you are running a local DNS inside your domain which is
not otherwise connected to the outside world, you probably want to

        R$* < @ $* . > $*       $#smtp $@ $2. $: $1 < @ $2. > $3

That is, send directly only to things you found in your DNS lookup;
anything else goes through SMART_HOST.

If you are not running DNS at all, it is important to use
FEATURE(nodns) to avoid having sendmail queue everything waiting
for the name server to come up.

[Return to contents]

| WHO AM I? |

Normally, the $j macro is automatically defined to be your fully
qualified domain name (FQDN).  Sendmail does this by getting your
host name using gethostname and then calling gethostbyname on the
result.  For example, in some environments gethostname returns
only the root of the host name (such as "foo"); gethostbyname is
supposed to return the FQDN ("").  In some (fairly rare)
cases, gethostbyname may fail to return the FQDN.  In this case
you MUST define confDOMAIN_NAME to be your fully qualified domain
name.  This is usually done using:
        define(`confDOMAIN_NAME', `$w.$m')dnl

[Return to contents]


To use FEATURE(mailertable), you will have to create an external
database containing the routing information for various domains.
For example, a mailertable file in text format might be:

        .my.domain           suucp:uuhost1

This should normally be stored in /etc/mailertable.  The actual
database version of the mailertable is built using:

        makemap hash /etc/mailertable.db < /etc/mailertable

The semantics are simple.  Any LHS entry that does not begin with
a dot matches the full host name indicated.  LHS entries beginning
with a dot match anything ending with that domain name -- that is,
they can be thought of as having a leading "*" wildcard.  Matching
is done in order of most-to-least qualified -- for example, even
though ".my.domain" is listed first in the above example, an entry
of "" will match the second entry since it is
more explicit.

The RHS should always be a "mailer:host" pair.  The mailer is the
configuration name of a mailer (that is, an `M' line in the file).  The "host" will be the hostname passed to
that mailer.  In domain-based matches (that is, those with leading
dots) the "%1" may be used to interpolate the wildcarded part of
the host name.  For example, the first line above sends everything
addressed to "" to that same host name, but using
the (presumably experimental) xnet mailer.

In some cases you may want to temporarily turn off MX records,
particularly on gateways.  For example, you may want to MX
everything in a domain to one machine that then forwards it
directly.  To do this, you might use the DNS configuration:

        *.domain.       IN      MX      0       relay.machine

and on relay.machine use the mailertable:

        .domain         smtp:[gateway.domain]

The [square brackets] turn off MX records for this host only.
If you didn't do this, the mailertable would use the MX record
again, which would give you an MX loop.

[Return to contents]


The user database was not originally intended for mapping full names
to login names (e.g., Eric.Allman => eric), but some people are using
it that way.  (I would recommend that you set up aliases for this
purpose instead -- since you can specify multiple alias files, this
is fairly easy.)  The intent was to locate the default maildrop at
a site, but allow you to override this by sending to a specific host.

If you decide to set up the user database in this fashion, it is
imperative that you not use FEATURE(stickyhost) -- otherwise,
e-mail sent to will be rejected.

To build the internal form of the user database, use:

        makemap btree /usr/data/base.db < /usr/data/base.txt

As a general rule, I am adamantly opposed to using full names as
e-mail addresses, since they are not in any sense unique.  For example,
the Unix software-development community has two Andy Tannenbaums,
at least two well-known Peter Deutsches, and at one time Bell Labs
had two Stephen R. Bournes with offices along the same hallway.
Which one will be forced to suffer the indignity of being
Stephen_R_Bourne_2?  The less famous of the two, or the one that
was hired later?

Finger should handle full names (and be fuzzy).  Mail should use
handles, and not be fuzzy.  [Not that I expect anyone to pay any
attention to my opinions.]

[Return to contents]


Plussed users
        Sometimes it is convenient to merge configuration on a
        centralized mail machine, for example, to forward all
        root mail to a mail server.  In this case it might be
        useful to be able to treat the root addresses as a class
        of addresses with subtle differences.  You can do this
        using plussed users.  For example, a client might include
        the alias:

                root:  root+client1@server

        On the server, this will match an alias for "root+client1".
        If that is not found, the alias "root+*" will be tried,
        then "root".

[Return to contents]


A lot of sendmail security comes down to you.  Sendmail 8 is much
more careful about checking for security problems than previous
versions, but there are some things that you still need to watch
for.  In particular:

* Make sure the aliases file isn't writable except by trusted
  system personnel.  This includes both the text and database

* Make sure that other files that sendmail reads, such as the
  mailertable, is only writable by trusted system personnel.

* The queue directory should not be world writable PARTICULARLY
  if your system allows "file giveaways" (that is, if a non-root
  user can chown any file they own to any other user).

* If your system allows file giveaways, DO NOT create a publically
  writable directory for forward files.  This will allow anyone
  to steal anyone else's e-mail.  Instead, create a script that
  copies the .forward file from users' home directories once a
  night (if you want the non-NFS-mounted forward directory).

* If your system allows file giveaways, you'll find that
  sendmail is much less trusting of :include: files -- in
  particular, you'll have to have /SENDMAIL/ANY/SHELL/ in
  /etc/shells before they will be trusted (that is, before
  files and programs listed in them will be honored).

In general, file giveaways are a mistake -- if you can turn them
off I recommend you do so.

[Return to contents]


Sam Leffler's FlexFAX software is still in beta test -- but he expects a
public version out "later this week" [as of 3/1/93].  The following
blurb is direct from Sam:

        $Header: /home/www/usail/mail/configuration/RCS/cf-README.html,v 1.2 1996/07/16 17:06:24 brier Exp $

        How To Obtain This Software (in case all you get is this file)
        The source code is available for public ftp on

        You can also obtain inst'able images for Silicon Graphics machines from

        For example,
            % ftp -n
            ftp> user anonymous
            ... <type in password>
            ftp> cd sgi/fax
            ftp> binary
            ftp> get v2.1.src.tar.Z

        In general, the latest version of the 2.1 release of the software is
        always available as "v2.1.src.tar.Z" or "v2.1.inst.tar" in the ftp
        directory.  This file is a link to the appropriate released version (so
        don't waste your time retrieving the linked file as well!) Any files of
        the form v2.1.*.patch are shell scripts that can be used to patch older
        versions of the source code.  For example, the file v2.1.0.patch would
        contain patches to update v2.1.0.tar.Z.  (Note to beta testers: this is
        different than the naming conventions used during beta testing.) Patch
        files only work to go between consecutive versions, so if you are
        multiple versions behind the latest release, you will need to apply
        each patch file between your current version and the latest.

        Obtaining the Software by Electronic Mail
        Do not send me requests for the software; they will be ignored (without
        response).  If you cannot use FTP at all, there is a service called
        "ftpmail" available from  you can send e-mail to
        this machine and it will use FTP to retrieve files for you and send you
        the files back again via e-mail.  To find out more about the ftpmail
        service, send a message to "" whose body
        consists of the single line "help".

        Obtaining the Software Within Silicon Graphics
        Internal to Silicon Graphics there are inst'able images on the host
        flake.asd in the directory /usr/dist.  Thus you can do something like:

            % inst -f

        to install the latest version of the software on your machine.

        What to do Once You've Retrieved Stuff
        The external distributions come in a compressed or uncompressed tar
        file.  To extract the source distribution:

            % zcat v2.1.src.tar.Z | tar xf -

        (uncompress and extract individual files in current directory).  To
        unpack and install the client portion of the inst'able distribution:

            % mkdir dist
            % cd dist; tar xf ../v2.1.inst.tar; cd ..
            % inst -f dist/flexfax
            inst> go

        (Note, the dist subdirectory is because some versions of inst fail if
        the files are in the current directory.) Server binaries are also
        included in the inst'able images as flexfax.server.*.  They are not
        installed by default, so to get them also you need to do:

            % inst -f flexfax
            inst> install flexfax.server.*
            inst> go

        The SGI binaries were built for Version 4.0.5H of the IRIX operating
        system.  They should work w/o problem on earlier versions of the
        system, but I have not fully tested this.  Also, note that to install a
        server on an SGI machine, you need to have installed the Display
        PostScript execution environment product (dps_eoe).  Otherwise, the fax
        server will not be able to convert PostScript to facsimile for

        If you are working from the source distribution, look at the file
        README in the top of the source tree.  If you are working from the inst
        images, the subsystem contains the README file and
        other useful pieces of information--the installed files are placed in
        the directory /usr/local/doc/flexfax).  Basically you will need to run
        the faxaddmodem script to setup and configure your fax modem.  Consult
        the README file and the manual page for faxaddmodem for information.

        FlexFAX Mail List
        A mailing list for users of this software is located on
        If you want to join this mailing list or have a list-related request
        such as getting your name removed from it, send a request to


        For example, to subscribe, send the line "subscribe flexfax" in
        the body of your message.  The line "help" will return a list of
        the commands understood by the mailing list management software.

        Submissions (including bug reports) should be directed to:


        When corresponding about this software please always specify what
        version you have, what system you're running on, and, if the problem is
        specific to your modem, identify the modem and firmware revision.

[Return to contents]


There are a large number of configuration options that don't normally
need to be changed.  However, if you feel you need to tweak them, you
can define the following M4 variables.  This list is shown in four
columns:  the name you define, the default value for that definition,
the option or macro that is affected (either Ox for an option or Dx
for a macro), and a brief description.  Greater detail of the semantics
can be found in the Installation and Operations Guide.

Some options are likely to be deprecated in future versions -- that is,
the option is only included to provide back-compatibility.  These are
marked with "*".

Remember that these options are M4 variables, and hence may need to
be quoted.  In particular, arguments with commas will usually have to
be ``double quoted, like this phrase'' to avoid having the comma
confuse things.  This is common for alias file definitions and for
the read timeout.

M4 Variable Name        Configuration   Description & [Default]
================        =============   =======================
confMAILER_NAME         $n macro        [MAILER-DAEMON] The sender name used
                                        for internally generated outgoing
confDOMAIN_NAME         $j macro        If defined, sets $j.  This should
                                        only be done if your system cannot
                                        determine your local domain name,
                                        and then it should be set to
                                        $w.Foo.COM, where Foo.COM is your
                                        domain name.
confCF_VERSION          $Z macro        If defined, this is appended to the
                                        configuration version name.
confFROM_HEADER         From:           [$?x$x <$g>$|$g$.] The format of an 
                                        internally generated From: address.
confRECEIVED_HEADER     Received:
      [.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b]
                                        The format of the Received: header
                                        in messages passed through this host.
                                        It is unwise to try to change this.
confCW_FILE             Fw class        [/etc/] Name of file used
                                        to get the local additions to the $=w
                                        (local host names) class.
confCT_FILE             Ft class        [/etc/sendmail.ct] Name of file used
                                        to get the local additions to the $=t
                                        (trusted users) class.
confTRUSTED_USERS       Ct class        [no default] Names of users to add to
                                        the list of trusted users.  This list
                                        always includes root, uucp, and daemon.
                                        See also FEATURE(use_ct_file).
confSMTP_MAILER         -               [smtp] The mailer name used when
                                        SMTP connectivity is required.
                                        One of "smtp", "smtp8", or "esmtp".
confUUCP_MAILER         -               [uucp-old] The mailer to be used by
                                        default for bang-format recipient
                                        addresses.  See also discussion of
                                        $=U, $=Y, and $=Z in the MAILER(uucp)
confLOCAL_MAILER        -               [local] The mailer name used when
                                        local connectivity is required.
                                        Almost always "local".
confRELAY_MAILER        -               [relay] The default mailer name used
                                        for relaying any mail (e.g., to a
                                        BITNET_RELAY, a SMART_HOST, or
                                        whatever).  This can reasonably be
                                        "uucp-new" if you are on a
                                        UUCP-connected site.
confSEVEN_BIT_INPUT     SevenBitInput   [False] Force input to seven bits?
confEIGHT_BIT_HANDLING  EightBitMode    [pass8] 8-bit data handling
confALIAS_WAIT          AliasWait       [10m] Time to wait for alias file
                                        rebuild until you get bored and
                                        decide that the apparently pending
                                        rebuild failed.
confMIN_FREE_BLOCKS     MinFreeBlocks   [100] Minimum number of free blocks on
                                        queue filesystem to accept SMTP mail.
                                        (Prior to 8.7 this was minfree/maxsize,
                                        where minfree was the number of free
                                        blocks and maxsize was the maximum
                                        message size.  Use confMAX_MESSAGE_SIZE
                                        for the second value now.)
confMAX_MESSAGE_SIZE    MaxMessageSize  [infinite] The maximum size of messages
                                        that will be accepted (in bytes).
confBLANK_SUB           BlankSub        [ ] Blank (space) substitution
confCON_EXPENSIVE       HoldExpensive   [False] Avoid connecting immediately
                                        to mailers marked expensive?
confCHECKPOINT_INTERVAL CheckpointInterval
                                        [10] Checkpoint queue files every N
confDELIVERY_MODE       DeliveryMode    [background] Default delivery mode.
confAUTO_REBUILD        AutoRebuildAliases
                                        [False] Automatically rebuild alias
                                        file if needed.
confERROR_MODE          ErrorMode       [print] Error message mode.
confERROR_MESSAGE       ErrorHeader     [undefined] Error message header/file.
confSAVE_FROM_LINES     SafeFromLine    Save extra leading From_ lines.
confTEMP_FILE_MODE      TempFileMode    [0600] Temporary file mode.
confMATCH_GECOS         MatchGECOS      [True] Match GECOS field.
confMAX_HOP             MaxHopCount     [25] Maximum hop count.
confIGNORE_DOTS*        IgnoreDots      [False; always False in -bs or -bd mode]
                                        Ignore dot as terminator for incoming
confBIND_OPTS           ResolverOptions [undefined] Default options for DNS
confMIME_FORMAT_ERRORS* SendMimeErrors  [True] Send error messages as MIME-
                                        encapsulated messages per RFC 1344.
confFORWARD_PATH        ForwardPath     [$z/.forward.$w:$z/.forward]
                                        The colon-separated list of places to
                                        search for .forward files.  N.B.: see
                                        the Security Notes section.
confMCI_CACHE_SIZE      ConnectionCacheSize
                                        [2] Size of open connection cache.
confMCI_CACHE_TIMEOUT   ConnectionCacheTimeout
                                        [5m] Open connection cache timeout.
confUSE_ERRORS_TO*      UserErrorsTo    [False] Use the Errors-To: header to
                                        deliver error messages.  This should
                                        not be necessary because of general
                                        acceptance of the envelope/header
confLOG_LEVEL           LogLevel        [9] Log level.
confME_TOO              MeToo           [False] Include sender in group
confCHECK_ALIASES       CheckAliases    [False] Check RHS of aliases when
                                        running newaliases.  Since this does
                                        DNS lookups on every address, it can
                                        slow down the alias rebuild process
                                        considerably on large alias files.
confOLD_STYLE_HEADERS*  OldStyleHeaders [True] Assume that headers without
                                        special chars are old style.
confDAEMON_OPTIONS      DaemonPortOptions
                                        [none] SMTP daemon options.
confPRIVACY_FLAGS       PrivacyOptions  [authwarnings] Privacy flags.
confCOPY_ERRORS_TO      PostmasterCopy  [undefined] Address for additional
                                        copies of all error messages.
confQUEUE_FACTOR        QueueFactor     [600000] Slope of queue-only function.
confDONT_PRUNE_ROUTES   DontPruneRoutes [False] Don't prune down route-addr
                                        syntax addresses to the minimum
confSAFE_QUEUE*         SuperSafe       [True] Commit all messages to disk
                                        before forking.
confTO_INITIAL          Timeout.initial [5m] The timeout waiting for a response
                                        on the initial connect.
confTO_HELO             Timeout.helo    [5m] The timeout waiting for a response
                                        to a HELO or EHLO command.
confTO_MAIL             Timeout.mail    [10m] The timeout waiting for a
                                        response to the MAIL command.
confTO_RCPT             Timeout.rcpt    [1h] The timeout waiting for a response
                                        to the RCPT command.
confTO_DATAINIT         Timeout.datainit
                                        [5m] The timeout waiting for a 354
                                        response from the DATA command.
confTO_DATABLOCK        Timeout.datablock
                                        [1h] The timeout waiting for a block
                                        during DATA phase.
confTO_DATAFINAL        Timeout.datafinal
                                        [1h] The timeout waiting for a response
                                        to the final "." that terminates a
confTO_RSET             Timeout.rset    [5m] The timeout waiting for a response
                                        to the RSET command.
confTO_QUIT             Timeout.quit    [2m] The timeout waiting for a response
                                        to the QUIT command.
confTO_MISC             Timeout.misc    [2m] The timeout waiting for a response
                                        to other SMTP commands.
confTO_COMMAND          Timeout.command [1h] In server SMTP, the timeout waiting
                                        for a command to be issued.
confTO_IDENT            Timeout.ident   [30s] The timeout waiting for a response
                                        to an IDENT query.
confTO_FILEOPEN         Timeout.fileopen
                                        [60s] The timeout waiting for a file
                                        (e.g., :include: file) to be opened.
confTO_QUEUERETURN      Timeout.queuereturn
                                        [5d] The timeout before a message is
                                        returned as undeliverable.
                                        [undefined] As above, for normal
                                        priority messages.
                                        [undefined] As above, for urgent
                                        priority messages.
                                        [undefined] As above, for non-urgent
                                        (low) priority messages.
confTO_QUEUEWARN        Timeout.queuewarn
                                        [4h] The timeout before a warning
                                        message is sent to the sender telling
                                        them that the message has been deferred.
confTO_QUEUEWARN_NORMAL Timeout.queuewarn.normal
                                        [undefined] As above, for normal
                                        priority messages.
confTO_QUEUEWARN_URGENT Timeout.queuewarn.urgent
                                        [undefined] As above, for urgent
                                        priority messages.
                                        [undefined] As above, for non-urgent
                                        (low) priority messages.
confTIME_ZONE           TimeZoneSpec    [USE_SYSTEM] Time zone info -- can be
                                        USE_SYSTEM to use the system's idea,
                                        USE_TZ to use the user's TZ envariable,
                                        or something else to force that value.
confDEF_USER_ID         DefaultUser     [1:1] Default user id.
confUSERDB_SPEC         UserDatabaseSpec
                                        [undefined] User database specification.
confFALLBACK_MX         FallbackMXhost  [undefined] Fallback MX host.
confTRY_NULL_MX_LIST    TryNullMXList   [False] If we are the best MX for a
                                        host and haven't made other
                                        arrangements, try connecting to the
                                        host directly; normally this would be
                                        a config error.
confQUEUE_LA            QueueLA         [8] Load average at which queue-only
                                        function kicks in.
confREFUSE_LA           RefuseLA        [12] Load average at which incoming
                                        SMTP connections are refused.
                        RecipientFactor [30000] Cost of each recipient.
confSEPARATE_PROC       ForkEachJob     [False] Run all deliveries in a separate
confWORK_CLASS_FACTOR   ClassFactor     [1800] Priority multiplier for class.
confWORK_TIME_FACTOR    RetryFactor     [90000] Cost of each delivery attempt.
confQUEUE_SORT_ORDER    QueueSortOrder  [Priority] Queue sort algorithm:
                                        Priority or Host.
confMIN_QUEUE_AGE       MinQueueAge     [0] The minimum amount of time a job
                                        must sit in the queue between queue
                                        runs.  This allows you to set the
                                        queue run interval low for better
                                        resposiveness without trying all
                                        jobs in each run.
confDEF_CHAR_SET        DefaultCharSet  [unknown-8bit] When converting
                                        unlabelled 8 bit input to MIME, the
                                        character set to use by default.
confSERVICE_SWITCH_FILE ServiceSwitchFile
                                        [/etc/service.switch] The file to use
                                        for the service switch on systems that
                                        do not have a system-defined switch.
confHOSTS_FILE          HostsFile       [/etc/hosts] The file to use when doing
                                        "file" type access of hosts names.
confDIAL_DELAY          DialDelay       [0s] If a connection fails, wait this
                                        long and try again.  Zero means "don't
                                        retry".  This is to allow "dial on
                                        demand" connections to have enough time
                                        to complete a connection.
confNO_RCPT_ACTION      NoRecipientAction
                                        [none] What to do if there are no legal
                                        recipient fields (To:, Cc: or Bcc:)
                                        in the message.  Legal values can
                                        be "none" to just leave the
                                        nonconforming message as is, "add-to"
                                        to add a To: header with all the
                                        known recipients (which may expose
                                        blind recipients), "add-apparently-to"
                                        to do the same but use Apparently-To:
                                        instead of To:, "add-bcc" to add an
                                        empty Bcc: header, or
                                        "add-to-undisclosed" to add the header
                                        ``To: undisclosed-recipients:;''.
confSAFE_FILE_ENV       SafeFileEnvironment
                                        [undefined] If set, sendmail will do a
                                        chroot() into this directory before
                                        writing files.
confCOLON_OK_IN_ADDR    ColonOkInAddr   [True unless Configuration Level > 6]
                                        If set, colons are treated as a regular
                                        character in addresses.  If not set,
                                        they are treated as the introducer to
                                        the RFC 822 "group" syntax.  Colons are
                                        handled properly in route-addrs.  This
                                        option defaults on for V5 and lower
                                        configuration files.
confMAX_QUEUE_RUN_SIZE  MaxQueueRunSize [0] If set, limit the maximum size of
                                        any given queue run to this number of
                                        entries.  Essentially, this will stop
                                        reading the queue directory after this
                                        number of entries are reached; it does
                                        _not_ pick the highest priority jobs,
                                        so this should be as large as your
                                        system can tolerate.  If not set, there
                                        is no limit.
confDONT_EXPAND_CNAMES  DontExpandCnames
                                        [False] If set, $[ ... $] lookups that
                                        do DNS based lookups do not expand
                                        CNAME records.  This currently violates
                                        the published standards, but the IETF
                                        seems to be moving toward legalizing
                                        this.  For example, if "FTP.Foo.ORG"
                                        is a CNAME for "Cruft.Foo.ORG", then
                                        with this option set a lookup of
                                        "FTP" will return "FTP.Foo.ORG"; if
                                        clear it returns "Cruft.FOO.ORG".  N.B.
                                        you may not see any effect until your
                                        downstream neighbors stop doing CNAME
                                        lookups as well.
confFROM_LINE           UnixFromLine    [From $g  $d] The From_ line used
                                        when sending to files or programs.
confOPERATORS           OperatorChars   [.:%@!^/[]+] Address operator
confSMTP_LOGIN_MSG      SmtpGreetingMessage
                                        [$j Sendmail $v/$Z; $b]
                                        The initial (spontaneous) SMTP
                                        greeting message.  The word "ESMTP"
                                        will be inserted between the first and
                                        second words to convince other
                                        sendmails to try to speak ESMTP.
confDONT_INIT_GROUPS    DontInitGroups  [False] If set, the initgroups(3)
                                        routine will never be invoked.  You
                                        might want to do this if you are
                                        running NIS and you have a large group
                                        map, since this call does a sequential
                                        scan of the map; in a large site this
                                        can cause your ypserv to run
                                        essentially full time.  If you set
                                        this, agents run on behalf of users
                                        will only have their primary
                                        (/etc/passwd) group permissions.

See also the description of OSTYPE for some parameters that can be
tweaked (generally pathnames to mailers).

[Return to contents]


Within this directory are several subdirectories, to wit:

m4              General support routines.  These are typically
                very important and should not be changed without
                very careful consideration.

cf              The configuration files themselves.  They have
                ".mc" suffixes, and must be run through m4 to
                become complete.  The resulting output should
                have a ".cf" suffix.

ostype          Definitions describing a particular operating
                system type.  These should always be referenced
                using the OSTYPE macro in the .mc file.  Examples
                include "bsd4.3", "bsd4.4", "sunos3.5", and

domain          Definitions describing a particular domain, referenced
                using the DOMAIN macro in the .mc file.  These are
                site dependent; for example, "CS.Berkeley.EDU.m4"
                describes hosts in the CS.Berkeley.EDU subdomain.

mailer          Descriptions of mailers.   These are referenced using
                the MAILER macro in the .mc file.

sh              Shell files used when building the .cf file from the
                .mc file in the cf subdirectory.

feature         These hold special orthogonal features that you might
                want to include.  They should be referenced using
                the FEATURE macro.

hack            Local hacks.  These can be referenced using the HACK
                macro.  They shouldn't be of more than voyeuristic
                interest outside the .Berkeley.EDU domain, but who knows?
                We've all got our own peccadillos.

siteconfig      Site configuration -- e.g., tables of locally connected
                UUCP sites.

[Return to contents]


The following sections detail usage of certain internal parts of the file.  Read them carefully if you are trying to modify
the current model.  If you find the above descriptions adequate, these
should be {boring, confusing, tedious, ridiculous} (pick one or more).

RULESETS (* means built in to sendmail)

   0 *  Parsing
   1 *  Sender rewriting
   2 *  Recipient rewriting
   3 *  Canonicalization
   4 *  Post cleanup
   5 *  Local address rewrite (after aliasing)
  1x    mailer rules (sender qualification)
  2x    mailer rules (recipient qualification)
  3x    mailer rules (sender header qualification)
  4x    mailer rules (recipient header qualification)
  5x    mailer subroutines (general)
  6x    mailer subroutines (general)
  7x    mailer subroutines (general)
  8x    reserved
  90    Mailertable host stripping
  96    Bottom half of Ruleset 3 (ruleset 6 in old sendmail)
  97    Hook for recursive ruleset 0 call (ruleset 7 in old sendmail)
  98    Local part of ruleset 0 (ruleset 8 in old sendmail)
  99    Guaranteed null (for debugging)


   0    local, prog     local and program mailers
   1    [e]smtp, relay  SMTP channel
   2    uucp-*          UNIX-to-UNIX Copy Program
   3    netnews         Network News delivery
   4    fax             Sam Leffler's FlexFAX software
   5    mail11          DECnet mailer


   B    Bitnet Relay
   C    DECnet Relay
   D    The local domain -- usually not needed
   E    reserved for X.400 Relay
   F    FAX Relay
   H    mail Hub (for mail clusters)
   L    Luser Relay
   M    Masquerade (who I claim to be)
   R    Relay (for unqualified names)
   S    Smart Host
   U    my UUCP name (if I have a UUCP connection)
   V    UUCP Relay (class V hosts)
   W    UUCP Relay (class W hosts)
   X    UUCP Relay (class X hosts)
   Y    UUCP Relay (all other hosts)
   Z    Version number


   E    addresses that should not seem to come from $M
   F    hosts we forward for
   L    addresses that should not be forwarded to $R
   M    domains that should be mapped to $M
   O    operators that indicate network operations (cannot be in local names)
   P    top level pseudo-domains: BITNET, DECNET, FAX, UUCP, etc.
   U    locally connected UUCP hosts
   V    UUCP hosts connected to relay $V
   W    UUCP hosts connected to relay $W
   X    UUCP hosts connected to relay $X
   Y    locally connected smart UUCP hosts
   Z    locally connected domain-ized UUCP hosts
   .    the class containing only a dot


   1    Local host detection and resolution
   2    Local Ruleset 3 additions
   3    Local Ruleset 0 additions
   4    UUCP Ruleset 0 additions
   5    locally interpreted names (overrides $R)
   6    local configuration (at top of file)
   7    mailer definitions
   9    special local rulesets (1 and 2)

Coming Soon......
Rewriting Rules
Sendmail Tips and Tricks.