sendmail.m4(8)sendmail.m4(8)NAMEsendmail.m4 - Introduction to using m4 macros to create a sendmail.cf
configuration file
OPERANDS
The following list provides definitions of the operands used in the
configuration files. The operands appear in the recommended usage
order. This macro specifies the name of the next-highest domain above
your own (yyy.xxx). It is used to determine which hosts you can send
mail to that might be close enough to be reached directly, and to fig‐
ure out where MyDomains are located. This macro specifies the list of
all the domains under ParentDomain that are aliases for your own. It
is a list of single tokens separated with blanks. These are qualified
under ParentDomain in actual use. You must include the single-token
component of MyDomain. For example, if the ParentDomain is ECD.COM and
MyDomain is AP.ECD.COM, then MyDomains must include at least the token
AP. This operand is used in conjunction with the _MailHub operand.
This macro specifies the fully-qualified domain that you are in. It
must end in _ParentDomain.
If you set both MyDomain and ParentDomain to the string LOCAL,
sendmail assumes that you do not have a domain, but instead use
single-token hostnames (which can include dashes and underscores
but not dots) and that you are using /etc/hosts or NIS, but not
BIND. This macro is used to initialize the $=w operand. If
your host is known by several names inside of _MyDomain, you
must put the first token of all names (optionally including the
first token of your /bin/hostname) into this list.
In a TruCluster Server cluster, you should also specify the
cluster alias and the unqualified hostnames of all the members
of the cluster. This macro specifies the domain name (@DOMAIN)
appended to any mail address that leaves the local domain and
does not have a domain name in its address. (For example, local
user names do not have the domain name in the address.)
Usually, _MyDomain is specified; therefore, the mail leaves the
domain with a host name (such as, wicked@AP.ECD.COM) even though
there is no such host.
If you do this, you need an MX RR at the root (“@”) of the
domain that points to some set of mail servers whose MyDomain's
variables include your domain. This is irrelevant if you are
using LOCAL for MyDomain and ParentDomain. Use this macro if
you are using rdist, or NIS to ensure that all aliases on all
machines in your local domain are equivalent. (They do not need
to have the same values, but the same alias names must be
present on all machines.)
Note
It is recommended that you use this macro, unless you have spe‐
cific reasons for not using it.
If you use this macro, mail sent to @MyDomain is treated as
local mail, which means that any host in the domain can strip
off the @MyDomain and search its aliases database to decide what
to do with the message.
Mail sent to other hosts in the local domain with MailCluster
turned on will have the hostname (rather than ExportedName)
appended to the username. Because it is local mail, you know it
came from some host in the local domain and you presumably want
to know which host.
Note
Setting ExportedName to MyDomain and turning on MailCluster,
creates an environment where all mail names are equivalent on
all hosts in the domain. This simplifies the address formats
for all local mail. You use this macro if your machine recog‐
nizes mail to user@localdomain and therefore can access anyone's
mailbox (usually through an aliases file containing the real
mailboxes for everyone who might receive such mail). A Mail Hub
treats all mail to user@localdomain as local mail by using the
aliases file.
This is different than a Mail Cluster, where every host acts as
a Mail Hub (by virtue of everyone having the same “all knowing”
aliases file). This macro specifies the mail spool location
(which is usually /var/spool/mqueue). Note that there is no
advantage to using /usr/spool/mail for this if that is a symlink
to /var/spool/mail. Using the correct names and avoiding sym‐
links is recommended. This macro specifies the list of user
names that are allowed to run sendmail with the -f option that
sets the envelope sender address. There are users that have a
legitimate need to use the -f; however, for security reasons, it
is recommended that only those users be allowed that option.
This macro specifies the list of users that have the @hostname
of the sending host added to their From: line, if they send mail
to some other host in the local domain. This procedure is per‐
formed regardless of the MailCluster and MailHub. This macro
sets the unqualified hostname.
This macro is not required. Under Tru64 UNIX sendmail it is rec‐
ommended that you do not use this operand. This macro enables
your machine to recognize POP customers as username.POP. This
is preferable to HostPOP. as shown in the following example. If
you use this macro, you must format your aliases as follows:
username:username.POP
Instead of the following format: username:username@POP
Be aware that older versions of the popaka utility create the
@pop style address. If you want to change, turn both TagPOP and
HostPOP on and wait for a new popaka utility, at which point you
can shut off HostPOP. This macro enables your system to be able
to recognize IMAP customers as username@IMAP. Older popaka
utilities generate aliases in this form. If you are using an
older version of the popaka utilities, you can enable HostIMAP.
However, you will not be able to name any host in your domain
“IMAP” because it would conflict with the sendmail.cf file's
internal meaning for the @IMAP string. It is recommend that you
use TagIMAP. This macro enables you to recognize DECnet-style
addresses or to communicate with DECnet. This macro only
applies to DECnet. You use this macro to define this to your
DECnet node name if your sendmail binary does not define $=y as
the result of DECnet's getnodename() call. If you have such a
binary, it is best not to define this variable because that way
you can share a single sendmail.cf file across all of your DEC‐
net nodes. Otherwise you need to build a separate sendmail con‐
figuration file for DECnet node, just to set $=y. Tru64 UNIX
automatically defines $=y if DECnet's installed. This macro
applies to DECnet only. You can use this macro, if you are
using the UTK Mail11 package. This macro enables your system to
recognize UUCP addresses. If you do not also define _GateUUCP,
you must run UUCP on your host. In most cases, mail with UUCP
addresses is relayed to a host that recognizes UUCP addresses to
process the address. This macro enables your system to recog‐
nize POP customers. This macro instructs sendmail to format
your headers in RFC 976 format. For example:
From: waxie@ap.ecd.com (Paul Waxie)
If you use this macro, you should define this to be T. These
macros control how mail that is destined for some other host in
your local domain is handled.
TransDomain is the transport used to reach other hosts or to
reach the designated gateway (usually smtpl which specifies
local SMTP).
If you decide to route all such local-domain mail through a
gateway, then specify the name of the gateway in GateDomain. If
you want the mail to go directly to the gateway, do not specify
anything for the GateDomain operand.
In practice, TransDomain is always set to smtpl and GateDomain
is always either null or the name of your local mail hub. How‐
ever, there is no penalty for sending local mail directly
between workstations and no advantage for sending such mail
through your mail hub. Using a gateway is not recommended for
local mail. These two macros perform the same functions as
TransDomain and GateDomain except that they control mail which
is sent to the parent domain rather than to the local domain.
In most domains, there are no security filters that restrict
SMTP traffic between hosts in the domain. If that is true in
your domain then it is recommended that you set TransParent to
smtp and set GateParent to null string.
As with local-domain mail, there is no real advantage to using a
gateway for local mail. These macros specify the transport to
be used and the gateway host for mail leaving the domain.
If you are directly connected to the Internet, then you can set
TransINET to smtp and leave GateINET empty.
If you need to use a gateway to reach the Internet, then set
TransINET to the protocol used by the gateway (uucp, mail11, or
smtp) and set GateINET to the name of the host you will reach
through that transport. That host will presumably deliver your
mail to its ultimate recipient or forward it to another host
that will deliver the mail or forward it on.
If you leave GateINET empty, then TransINET is ignored because
it must be the local smtp transport. These macros specify the
transport and the gateway for UUCP mail. Note that if GateUUCP
is empty, then TransUUCP is ignored since the local uucp trans‐
port must be used. In which case uux is used as the transport.
You might set TransUUCP to smtpr. GateUUCP host has aliases for
all of your users. This permits outbound UUCP addresses to omit
your local host name. This macro specifies the UUCP host name
for all of the members of your TruCluster Server cluster running
the UUCP protocol. Use this macro if you are running UUCP on
your system. See protocols.map(4) for more information. This
macro specifies the arguments for UUCP. For a complete list of
the possible options, see uux(1). This macro specifies the name
of a host on your network that is capable of accepting mail sent
to the USENET.
If there is no such host on your network, leave this macro
empty.
Note that Tru64 UNIX does not currently include the software
necessary on the receiving host, because it varies according to
whether you are running C News or B News or INN. This macro
applies to DECnet mail only. If your users or your inbound
mail11 listener puts a pseudodomain name other than on incoming
addresses, sendmail needs to know. This macro applies to DECnet
only.
If GateIV is set to an empty string, then sendmail attempts to
deliver the mail directly using TransIV (which is almost always
smtp).
If you have MX RRs for all of your mail11 hosts then you can use
SMTP to reach them or at least the closest relay host.
If GateIV is set to a fully qualified host name, then TransIV is
used to forward the mail to that host, unless GateIV is set to
the same hostname. In this case the mail11 mailer is called
directly.
This lets you share a sendmail.cf file across all of your work‐
stations and mail11 gateway machines, because the mail will go
to the designated mail11 gateway first, which, on forwarding,
the mail will recognize its own name as the designated gateway
and instead call the mail11 transport.
It is recommended that you set TransIV to smtpr if the GateIV
host has aliases for all of your users. This enables outbound
DECnet addresses to omit the local host name. This macro
applies to DECnet only.
Mail from a DECnet node is always encapsulated in a pseu‐
dodomain. The DECnet pseudodomain is an arbitrary string that
should be used uniformly by your site or organization. The DEC‐
net pseudodomain must always appear after the parent domain. For
example, in the following domain name, QNET is the DECnet pseu‐
dodomain portion of the domain names:
NODEONE.QNET.ECD.COM
NODETWO.QNET.ECD.COM
PhaseIVdomain is the non-qualified name of the pseudodomain. It
is always qualified with ParentDomain before being emitted into
the Internet.
This can be anything you want but is usually the name of the
DECnet network. Do not set this to DNET. Set it to the proper
name of your network, not the name of the network's technology.
This macro specifies the Phase IV node names of the nodes in
your TruCluster Server cluster. Use this macro only if your node
is running DECnet. This macro specifies the Phase IV node
address. Use this macro only if your node is running DECnet.
This macro applies to DECnet only.
This macro specifies the location of the mail11 binary. For this
operating system it is located in /usr/sbin/mail11v3. This
macro applies to DECnet only.
Unnamed DECnet nodes are reachable through the AA.NNN:: nota‐
tion. The AA in this case is actually of higher precedence than
the NNN. You may want to reverse the order when rewriting into
Internet form because Internet addresses have higher precedence
toward the right side. Whatever you do, you must do it consis‐
tently across all mail11 gateways in your network, and you will
probably not be able to change your mind later. This macro
applies to DECnet only.
This macro applies to DECnet Phase V only. It specifies the
namespace that sendmail assumes for any mail it receives in
without a namespace, if you are running DECnet Phase V. It is
recommended that you make it the name of the namespace you are
in. If you are running DECnet Phase IV, you must get the name of
the namespace from your network administrator. These macros
apply to DECnet Phase V only. They specify the transport, gate‐
way, and pseudodomain for DECnet Phase V mail.
Note that Phase V names are always reversed so there is no
ReversePhaseV variable. This macro specifies the Phase V node
names of the nodes in your TruCluster Server cluster. Use this
macro only if your node is running DECnet. This macro enables
your system to MR or UMC addresses. If you do not define GateMs‐
gRout you must run UMC on your host. Most hosts use a gateway
to reach MR. This macro applies to DEC MessageRouter (mail-
plus) only. They define the transport, gateway, and pseu‐
dodomain. This macro applies to the DEC MessageRouter (mail-
plus) only. It specifies other pseudodomains that the software
or your users may use, expecting them to be recognized as Mes‐
sage Router pseudodomains. Use this macro if you have an IDA
version of sendmail. This turns on split rewrite rules (O/).
It also allows for local aliases lookup. If you are usingTru64
UNIX's sendmail utility, it is recommended that you set this op‐
erand to be T. This macro specifies that aliases in your local
aliases file are _NonHiddenUsers. You must have _IDA defined
because it uses IDA features to do the aliases lookup. See the
explanation of _NonHiddenUsers and _IDA. This macro specifies
to bypass most of the other routing options (for example, Gate‐
Domain) and forces your mail to be sent by _TransINET to your
_GateINET machine. This allows workstations with simple mail
configurations to create mail locally, but have it appear as if
it came from the main relay (GateINET) machine. Using this
option can simplify things for the system administrator, by fun‐
neling all mail through central, well-maintained machines.
The only mail that is delivered locally (to the simple worksta‐
tion) is the mail addressed to the user names contained in _Non‐
HiddenUsers. This macro enables sendmail to work in a TruClus‐
ter Server cluster environment. Set it to T if your system is
part of a cluster. This macro specifies the alias for your Tru‐
Cluster Server cluster. Use it only if your system is configured
as part of a cluster. This macro specifies the unqualified
names of the nodes in your TruCluster Server cluster that can
handle X.25 (PSI) mail. Use this macro only if you are running
X.25 on your system. This macro specifies that sendmail will
use an LDAP server to resolve aliases. If you intend to use
LDAP, set this macro to T. See Lightweight Directory Access
Protocol for more information. This macro defines the map type
and LDAP search string for sendmail to specify when it contacts
an LDAP server for alias resolution. The map type is ldapx.
The sendmail command supports most of the standard map options
as well as options specific to LDAP. The following LDAP options
are the ones most users need, but you can specify additional
parameters depending on your application.
You must specify arguments for each LDAP option as strings,
therefore, you must enclose the arguments in double quotes (").
Also, the arguments must immediately follow the associated LDAP
option, that is, leave no space between options and double
quotes. LDAP base Distinguished Name (DN) search string LDAP
server's host name list. This contains the list of server names
to use for an LDAP search. The list of names is separated by
white space. String containing a list of attribute/value pairs
for which to search in the LDAP database. The syntax for each
pair is attribute=%s, where %s is the token for which to search.
If you need to specify more than one attribute/value pair, you
must enclose each pair in parentheses (). In addition, you must
begin the string with (|). For example:
"(|)(attr1=%s)(attr2=%s)(...)(attrN=%s)"
You can specify up to 1024 attribute/value pairs. String con‐
taining a list of comma-separated attributes for which to return
values. For each LDAP record that matches the attribute/value
pairs you specify in the -k option, the LDAP server returns the
corresponding attribute you specify with the -v option.
The brackets {} are necessary to tell the m4 command to treat
the double quotes as literal; otherwise, the quotes are not pre‐
served in the sendmail.cf output file.
For example, assume your LDAP base DN is compaq, your LDAP
server name is ldap.site.com, the search attribute is mailaddr,
and the return attribute is forwardAddr. You would specify the
_LDAPParam macro as follows (the backslash indicates line con‐
tinuation): define(_LDAPParam, {ldapx -b"o=compaq"
-h"ldap.site.com" \
-k"(mailaddr=%s)" -v{"forwardAddr"}})dnl
DESCRIPTION
The mailsetup script enables you to create new mail configurations. If
you have experience creating sendmail.cf configuration files or your
system requires specialized configuration files, you might want to cre‐
ate your configuration files manually.
Use the macros described in this reference page to generate a configu‐
ration file. You should save your configuration file under the name
hostname.m4, where hostname is the name of your system or the alias for
a TruCluster Server cluster.
After you create the m4 file with the operands you need, you can gener‐
ate the sendmail.cf file by issuing the following command: # m4 -D_Con‐
figfile=hostname.m4 sendmail m4 > sendmail.cf
You must be in the /var/adm/sendmail directory to use this command.
The sendmail.m4 package used byTru64 UNIX provides the following func‐
tions: Rewrites addresses, encapsulating mail from non-Internet proto‐
cols (for example, DECnet) within pseudodomains. This helps to ensure
that replies are sent back to the correct address, where they can be
handled appropriately. Performs routing, based on the domain to which
the mail is sent. Supports multiple return address formats, including
domain-based addresses. For example, a host with the name
myhost.mysite.ecd.com would normally format a user's mail address as
user@myhost.mysite.ecd.com, or user@cluster_alias.mysite.ecd.com in a
TruCluster Server cluster (which changes the address only for SMTP). By
using the _ExportedName operand, you can set the return address to be
mysite.ecd.com. By using the _MailHub and MyDomain operands, your mail
system recognizes the phrase mysite.ecd.com as a synonym for this host.
The dnl command is “delete to newline” command and causes the m4 com‐
piler to ignore the dnl characters and all text that follows it, up to
and including the end of line. If you do not follow a define command
with a dnl command, then the newline after the right parenthesis ()) is
emitted into the output (which is a sendmail.cf file).
Blank lines are permitted in the sendmail.cf file; however, they are
unnecessary and not recommended.
Braces ({}) are used as quoting characters. You can use them even when
they are not required.
Note that null definitions have the following of the form: define(Oper‐
and, {})
The only rule you must follow in creating the configuration m4 file is
to surround literal text with braces ({}); however, you must leave
macro names (which you presumably want expanded by m4) unquoted. (That
is, do not enclose macros that you want expanded in braces ({}).)
Mailers
The sendmail program invokes a mailer to handle your mail. Usually,
this is local (for local delivery on the host), smtp (standard SMTP),
smtpl (SMTP local), or smtpr (SMTP to relay) for delivery over the
Internet. These mailers (smtp, smtpl, and smtpr) invoke SMTP to deliver
the mail; however, they differ in how they rewrite the return address.
If you are in doubt as to which mailer to use, it is safest to use
smtp.
The smtp mailer qualifies your mail with the ExportedName operand,
except for mail sent from NonHiddenUsers or from an alias (if Aliases‐
Local is true).
The smtpl mailer handles mail sent within you local domain. This
mailer is used when mail is sent to users within the local domain.
Depending on how the _MailCluster and _NonHiddenUsers operands are
defined, the hostname is removed from the return address before the
mail is sent.
The smtpr mailer always removes the hostname, except for _NonHidde‐
nUsers. This is useful when the relay machine is a mail hub and has
aliases for all users in your mail system.
Routing
The sendmail.m4 package performs some routing decisions based on the
domain in which the address ends. In general, you can configure your
system to check for some special cases (for example, DECnet or UUCP
style addresses). If the address does not conform to any of the cases
specified, it will check to see if the mail resides in your local
domain (_GateLocal), parent domain (GateParent), or is outside your
local network (GateINET). You can configure your system to pass mail
to and from the Internet by setting the _GateINET operand to the name
of the Internet gateway on your local network and leaving the GateDo‐
main and GateParent operands blank.
Lightweight Directory Access Protocol
The sendmail command supports the Lightweight Directory Access Protocol
(LDAP) for alias resolution. LDAP is an open protocol for accessing
directory services. An LDAP server provides information, such as email
addresses and public keys, to applications running on client systems.
Usually, when sendmail parses a recipient's address and determines that
the address is local, it looks up the address to determine if there are
any aliases associated with it (see aliases(4)). If sendmail does not
find an alias, it looks in the file in the recipient's home directory
to see if the recipient has any personal aliases. While this works well
for a single system, it becomes cumbersome to maintain in a distributed
environment. Performance suffers if the list of aliases becomes too
large.
With LDAP as another means for storing user alias information, sendmail
can share aliases in a distributed fashion, and as a result, system
administrators do not have to maintain several databases. Furthermore,
because there are fewer databases and the LDAP servers that serve them
are typically dedicated machines, address resolution is more efficient.
(Note that the sendmail command itself requires a fair amount of
resources, and performing alias resolution on the same system can be
costly.)
To configure sendmail with LDAP, set the _LDAPMap operand to {T} and
specify the LDAP search string in the _LDAPParam operand. The appropri‐
ate map line and rules are added to the system sendmail.cf file. This
tells sendmail to perform an LDAP lookup for the receipient's address
in addition to the standard alias and lookup. If no matches are found,
the recipient address is considered to be local to this system.
sendmail.m4(8)