Relaying is the process of sending mail from one system to another. This is also called routing. This is the main function of Sendmail. Some features are used to relay mail around the inside of the network. Some features are used to relay messages outside of your network. The features that move mail around the interior of your environment will be listed here. The features that allow mail to move outside of your environment will be listed on the Unsolicited Commercial E-mail web page since those features are used primarily for that purpose.
Relays are defined using:
define(`relay_name', `agent:host')
For e-mail the agent is smtp. If an agent is not specified then it defaults to "relay".
The relay names that we'll discuss on this web page are used primarily for moving mail around the interior of a network.
fax_relay - Fax relay
local_user - Those users who remain local to the machine
luser_relay - Relay for unknown local users
local_net_config - Intended as a place to override settings of the smart host macro
null_client - For a workstation with no mail client software installed
mail_hub - All local mail delivery to a central server
smart_host - The ultimate relay - all outbound mail is sent to another host
FAX RELAY - Allows you to send faxes via e-mail. If the local host is not setup with fax software then you need to relay it to the machine that has the fax software.
define(`fax_relay',`relay-host-name')dnl
Any e-mail addresses that end with .FAX will be forwarded to fax_relay.
LOCAL USER - Allows unqualified usernames, those with no @host/domain part to be delivered locally regardless of other relaying options that may be set on the local machine.
The root user is an example of an e-mail account that you probably would want to have that users e-mail remaining on the local machine. By remaining local, aliasing is also allowed to take place. To enable this option use:
LOCAL_USER(`username')
This adds users to class L; you could also use:
LOCAL_USER_FILE(`/path/to/filename')
if you simply wanted to put all the names into a text file, one account per line.
LOCAL_RELAY
The site that will handle unqualified names -- that is, names without an @domain extension. Normally MAIL_HUB is preferred for this function. LOCAL_RELAY is mostly useful in conjunction with FEATURE(`stickyhost') -- see the discussion of stickyhost below. 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 agents.
LUSER_RELAY
The site that will handle lusers -- that is, apparently local names that aren't local accounts or aliases. To specify a local user instead of a site, set this to ``local:username''.
define(`luser_relay',`relay_host')dnl
FEATURE(`preserve_luser_host') - Preserve the name of the recipient host if LUSER_RELAY is used. Without this option, the domain part of the recipient address will be replaced by the host specified as LUSER_RELAY.
LOCAL_NET_CONFIG - Allows a machine to deliver mail to any host on the local network but all other mail is then forwarded to the smart_host.
NULL CLIENT - Some sites have a number of workstations that never receive mail directly, they use a mail server instead. Normally, all clients like this send their mail as though the mail is from the mail server, and they relay all their mail through that server rather than sending the mail directly. This feature is for those workstations.
feature(`nullclient',`host.domain')
All mail is relayed through host.domain. Host.domain must be a fully qualified host name.
MAIL HUB - Designating one or more machines as mail hubs allows you to centralize mail services. All mail addressed to local users are forwarded instead to a central mail hub. Then you would NFS mount the message queue directory back to the workstation so the user's can read their mail, or install POP or IMAP software on the mail hub machine for the user's to use. To enable this feature, use:
define(`MAIL_HUB',`hub_machine_name')
SMART HOSTS - Smart hosts let you setup outbound message routing. If you have a firewall in place you may not want all of your host machines to be able to send e-mail directly to the Internet.
You may only want a few machines to have access through the firewall. This is where you use smart hosts. If the machine you are configuring is to deliver mail locally but will not talk directly to the Internet you would configure that machine to send mail to a machine that has Internet access by using:
define(`SMART_HOST',`outside.facing.host')
Whatever mail that could not be delivered within the local network would then be forwarded to the smart host and it would be up to the smart host to deliver the mail on behalf of the other host. The reason they're called smart hosts is they have the ability to query DNS and have access to the outside world and so they can deliver the mail. Your other machine may not be that "smart."
FEATURE(`preserve_local_plus_detail') - Preserve the +detail portion of the address when passing address to local delivery agent. Disables alias and .forward +detail stripping (e.g. given user+detail, only that address will be looked up in the alias file; user+* and user will not be looked up). Only use if the local delivery agent in use supports +detail addressing.
Local Relays, Mail Hub, Stick Host and Smart Hosts - an example
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 "relay". 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
LOCAL_USER(`usernames')
This adds users to class {L}; you could also use
LOCAL_USER_FILE(`filename')
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 "relay". 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. Note: there is a (long standing) bug which keeps this combination from working for addresses of the form user+detail.
Names in class {L} will be delivered locally, so you MUST have aliases or .forward files for them.
For example, if you 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 unqualified 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 or bracketed addresses (e.g., "eric@mastodon.CS.Berkeley.EDU" or "eric@[127.0.0.1]").
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.
For duplicate suppression to work properly, the host name is best specified with a terminal dot:
define(`MAIL_HUB', `host.domain.')
note the trailing dot ---^
FEATURE(`stickyhost')
This feature is sometimes used with LOCAL_RELAY, although it can be used for a different effect with MAIL_HUB.
When used without MAIL_HUB, email sent to "user@local.host" are marked as "sticky" -- that is, the local addresses aren't matched against UDB, don't go through ruleset 5, and are not forwarded to the LOCAL_RELAY (if defined).
With MAIL_HUB, mail addressed to "user@local.host" is forwarded to the mail hub, with the envelope address still remaining "user@local.host". Without stickyhost, the envelope would be changed to "user@mail_hub", in order to protect against mailing loops.
FEATURE(`relay_hosts_only')
By default, names that are listed as RELAY in the access db and class {R} are treated as domain names, not host names. For example, if you specify ``foo.com'', then mail to or from foo.com, abc.foo.com, or a.very.deep.domain.foo.com will all be accepted for relaying. This feature changes the behaviour to lookup individual host names only.
Be aware of the following:
Be consistent on the relaying configuration of all your host machines. If one host inside of your domain does not allow the relaying of UUCP style addresses, then all of your hosts should probably do the same. Otherwise you may inadvertently allow something to be relayed that you probably do not want to be relayed.
Next Section: Masquerading - 10 of 32