Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Apropos / Subsearch:
optional field

sendmail.m4(8)						       sendmail.m4(8)


  sendmail.m4 -	Introduction to	using m4 macros	to create a sendmail.cf	con-
  figuration file


  The following	list provides definitions of the operands used in the confi-
  guration files.  The operands	appear in the recommended usage	order.

  define(_ParentDomain,	{yyy.xxx})dnl
      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	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 operand is used in
      conjunction with the _MailHub operand.

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

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


	 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.

      Mail sent	to other hosts in the local domain with	MailCluster turned on
      will have	the hostname (rather than ExportedName)	appended to the	user-
      name.  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
	 an environment	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 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.

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

  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


      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

  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 sendmail.cf
      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 com-
      municate 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 sendmail.cf 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

  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: waxieATap.com (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 operand.

      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	gate-
      way 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 gate-
      way 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 Tran-
      sINET 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

      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 tran-

      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(_MyUUCPnameList, {host})dnl
      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

  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 sendmail.cf	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 tran-

      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 uni-
      formly 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



      PhaseIVdomain is the non-qualified name of the pseudodomain.  It is
      always qualified with ParentDomain before	being emitted into the Inter-

      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(_MyIVnameList,	{})dnl
      This macro specifies the Phase IV	node names of the nodes	in your	Tru-
      Cluster Server cluster. Use this macro only if your node is running

  define(_MyIVaddrList,	{})dnl
      This macro specifies the Phase IV	node address. Use this macro only if
      your node	is running DECnet.

  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. What-
      ever 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

  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 adminis-

  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 Rever-
      sePhaseV variable.

  define(_MyVnameList, {})dnl
      This macro specifies the Phase V node names of the nodes in your Tru-
      Cluster Server cluster. Use this macro only if your node is running

  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 usingTru64 UNIX's	sendmail utility, it is	recommended that you
      set this operand 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	_NonHid-
      denUsers 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 con-
      figurations 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 cen-
      tral, 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.

  define(_Cluster, {})dnl
      This macro enables sendmail to work in a TruCluster Server cluster
      environment.  Set	it to T	if your	system is part of a cluster.

  define(_ClusterAlias,	{})dnl
      This macro specifies the alias for your TruCluster Server	cluster. Use
      it only if your system is	configured as part of a	cluster.

  define(_MyUnqualNameList, {})dnl
      This macro specifies the unqualified names of the	nodes in your Tru-
      Cluster Server cluster that can handle X.25 (PSI)	mail. Use this macro
      only if you are running X.25 on your system.

  define(_LDAPMap, {})dnl
      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 Light-
      weight Directory Access Protocol for more	information.

  define(_LDAPParam, {})dnl
      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 argu-
      ments 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:

	  You can specify up to	1024 attribute/value pairs.

	  String containing 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 preserved
	  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 continuation):
	   define(_LDAPParam, {ldapx -b"o=compaq" -h"ldap.site.com" \
	    -k"(mailaddr=%s)" -v{"forwardAddr"}})dnl


  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 create your
  configuration	files manually.

  Use the macros described in this reference page to generate a	configuration
  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 generate
  the sendmail.cf file by issuing the following	command:

       # m4 -D_Configfile=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 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 han-
       dled 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

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

  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 operand, except
  for mail sent	from NonHiddenUsers or from an alias (if AliasesLocal is

  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 _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 operand to the name	of the Internet	gateway	on your	local network
  and leaving the GateDomain 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 direc-
  tory 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 .forward 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 environ-
  ment.	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 administra-
  tors 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	appropriate
  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 .forward lookup. If	no matches are found, the
  recipient address is considered to be	local to this system.