Content-type: text/html Man page of sendmail.m4


Section: Maintenance Commands (8)
Index Return to Main Contents


sendmail.m4 - Introduction to using m4 macros to create a configuration file  


The mailsetup script enables you to create new mail configurations. If you have experience creating configuration files or your system requires specialized configuration files, you may want to create your configuration files manually.

The macros described in this reference page can help you generate a configuration file manually. These parameters are then used as input to generate a new It is suggested that you save different configurations under the name hostname.m4 (where hostname is the name of your system) or some other suitable mnemonic.

After you create the m4 file with the parameters you want, you can generate the file by issuing the following command: # m4 -D_Configfile=hostname.m4 sendmail m4 > You must be in the /var/adm/sendmail directory to use this command.

The sendmail.m4 package used by Tru64 UNIX provides the following functions: Rewrites addresses, encapsulating mail from non-Internet protocols (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 would normally format the mail address as By using the _ExportedName parameter, you can set the return address to be By using the _MailHub and MyDomain parameters, your mail system recognizes the phrase as a synonym for this host. Supports optionally stripping off host names for mail sent within your local domain, leaving the unqualified user name. This feature can improve the readability of mail sent within your local domain. The dnl command is "delete to newline" command and causes the m4 compiler 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 file).

Blank lines are permitted in the 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(Parameter, {})

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 ({}).)  


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 parameter, except for mail sent from NonHiddenUsers or from an alias (if AliasesLocal 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 parameters are defined, the hostname is removed from the return address before the mail is sent.

The smtpr mailer always removes the hostname, except for _NonHiddenUsers. This is useful when the relay machine is a mail hub and has aliases for all users in your mail system.  


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 parameter to the name of the Internet gateway on your local network and leaving the GateDomain and GateParent parameters blank.  


The following list provides definitions of the parameters used in the configuration files. The parameters appear in the recommended usage order.

define(_ParentDomain, {})dnl

This macro specifies the name of the next-highest domain above your own ( It is used to determine which hosts you can send mail to that might be close enough to be reached directly, and to figure out where MyDomains are located.

define(_MyDomains, {domain ... })dnl

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 parameter is used in conjunction with the _MailHub parameter.

define(_MyDomain, {domain.}_ParentDomain)dnl

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.

define(_MyNicknames, {})dnl

This macro is used to initialize the $=w parameter. 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.

define(_exportedName, _MyDomain)dnl

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.

define(_MailCluster, {T})dnl

Use this macro if you are using rdist, or NIS to insure 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.)


It is recommended that you use this macro, unless you have specific 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. Also, setting this variable will cause mail sent between hosts in the local domain to have no @hostname appended to any address, which is beneficial to the readability of local mail headers.

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.


Setting ExportedName to MyDomain and turning on MailCluster, creates a mail cluster where all mail names are equivalent on all hosts in the domain. This simplifies the address formats for all local mail.

define(_MailHub, {T})dnl

You use this macro if your machine recognizes 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).

define(_QueueDir, {directory})dnl

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 symlinks is recommended.

define(_TrustedUsers, {list})dnl

This macro specifies the list of user names that are allowed to run sendmail with the -f flag 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.

define(_NonHiddenUsers, {list})dnl

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 performed regardless of the MailCluster and MailHub.

define(_UnqualifiedW, {T})dnl

This macro sets the unqualified hostname.

This macro is not required. Under Tru64 UNIX sendmail it is recommended that you do not use this parameter.

define(_TagPOP, {T})dnl

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:


Instead of the following format:


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.

define(_HostIMAP, {T})dnl

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 file's internal meaning for the @IMAP string. It is recommend that you use TagIMAP.

define(_DECNet, {T})dnl

This macro enables you to recognize DECnet-style addresses or to communicate with DECnet.

define(_DollarY, {})dnl

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 file across all of your DECnet nodes. Otherwise you need to build a separate sendmail configuration file for DECnet node, just to set $y. Tru64 UNIX automatically defines $y if DECnet's installed.

define(_UTK_Mail11, {T})dnl

This macro applies to DECnet only. You can use this macro, if you are using the UTK Mail11 package.

define(_UUCP, {T})dnl

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.

define(_POP, {T})dnl

This macro enables your system to recognize POP customers.

define(_RFC976, {})dnl

This macro instructs sendmail to format your headers in RFC 976 format. For example: From: (Paul Waxie) If you use this macro, you should define this to be T.

define(_TransDomain, {transport})dnl define(_GateDomain, {})dnl

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 parameter.

In practice, TransDomain is always set to smtpl and GateDomain is always either null or the name of your local mail hub. However, 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.

define(_TransParent, {smtp})dnl define(_GateParent, {})dnl

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.

define(_TransINET, {transport})dnl define(_GateINET, {host.}_MyDomain)dnl

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.

define(_TransUUCP, {transport})dnl define(_GateUUCP, {host.}_MyDomain)dnl

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 transport 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.

define(_MyUUCPname, {host})dnl

This macro specifies the UUCP host name for your system. Use this macro only if you are running UUCP on your system.

define(_UuxArgs, {options})dnl

This macro specifies the arguments for UUCP. For a complete list of the possible options, see uux(1).

define(_GateUsenet, {host.}_MyDomain)dnl

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.

define(_AddMail11Cl, {pseudodomain})dnl

This macro applies to DECnet mail only. If your users or your inbound mail11 listener puts a pseudodomain name other than .DNET on incoming addresses, sendmail needs to know.

define(_TransIV, {transport})dnl define(_GateIV, {})dnl

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 file across all of your workstations 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.

define(_PhaseIVdomain, {pseudodomain})dnl

This macro applies to DECnet only.

Mail from a DECnet node is always encapsulated in a pseudodomain. The DECnet pseudodomain is an arbitrary string that should be used uniformly by your site or organization. The DECnet pseudodomain must always appear after the parent domain. For example, in the following domain name, QNET is the DECnet pseudodomain 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.

define(_Mail11path, {/usr/sbin/mail11v3})dnl

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.

define(_ReversePhaseIV, {})dnl

This macro applies to DECnet only.

Unnamed DECnet nodes are reachable through the AA.NNN:: notation. 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 consistently across all mail11 gateways in your network, and you will probably not be able to change your mind later.

define(_PhaseVns, {})dnl

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.

define(_TransV, {transport})dnl define(_GateV, {gateway})dnl define(_PhaseVdomain, {pseudodomain})dnl

These macros apply to DECnet Phase V only. They specify the transport, gateway, and pseudodomain for DECnet Phase V mail.

Note that Phase V names are always reversed so there is no ReversePhaseV variable.

define(_UMC, {})dnl

This macro enables your system to MR or UMC addresses. If you do not define GateMsgRout you must run UMC on your host. Most hosts use a gateway to reach MR.

define(_TransMR, {transport})dnl define(_GateMR, {gateway.}_MyDomain)dnl define(_MsgRoutDomain, {pseudodomain})dnl

This macro applies to DEC MessageRouter (mail-plus) only. They define the transport, gateway, and pseudodomain.

define(_GateMsgRoutCl, {list})dnl

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 Message Router pseudodomains.

define(_IDA, {T})dnl

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 using Tru64 UNIX's sendmail utility, it is recommended that you set this parameter to be T.

define(_AliasesLocal, {T})dnl

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.

define(_RelayAll, {})dnl

This macro specifies to bypass most of the other routing options (for example, GateDomain) 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 funneling all mail through central, well-maintained machines.

The only mail that is delivered locally (to the simple workstation) is the mail addressed to the user names contained in _NonHiddenUsers. delim off




This document was created by man2html, using the manual pages.
Time: 02:40:40 GMT, October 02, 2010