System Administration Guide: Resource Management and Network Services

Chapter 26 Mail Services (Reference)

The sendmail program is a mail transport agent that uses a configuration file to provide aliasing and forwarding, automatic routing to network gateways, and flexible configuration. The Solaris operating environment supplies standard configuration files that most sites can use. Chapter 24, Mail Services (Overview) provided an introduction to the components of mail services and a description of a typical mail service configuration. Chapter 25, Mail Services (Tasks) explained how to set up and administer an electronic mail system. This chapter provides information on the following topics.

See Chapter 27, What's New With Mail Services (Reference) for a description of the new features that are included in version 8.12 of sendmail, the version that is in this Solaris 9 release. You can also read about changes to mail.local, mailstats, makemap, and about a new maintenance utility, editmap. For details that are not covered in these chapters, see the man pages for sendmail(1M), mail.local(1M), mailstats(1), makemap(1M), and editmap(1M).

Solaris Version of sendmail

This section, which includes the following topics, describes some of the differences in the Solaris version of sendmail as compared to the generic Berkeley version.

Flags Used and Not Used to Compile sendmail

The following tables list the flags that are used when compiling the version of sendmail that is delivered with the Solaris 9 release. If your configuration requires other flags, you need to download the source and recompile the binary. You can find information about this process at http://www.sendmail.org.

Table 26–1 General sendmail Flags

Flag 

Description 

SOLARIS=20900

Support for the Solaris 9 operating environment. 

MILTER

Support for the Mail Filter API. 

NETINET6

Support for IPv6. This flag has been moved from conf.h to Makefile.

Table 26–2 Maps and Database Types

Flag 

Description 

NDBM

Support for ndbm databases

NEWDB

Support for db databases

USERDB

Support for the User database

NIS

Support for nis databases

NISPLUS

Support for nisplus databases

LDAPMAP

Support for LDAP maps

MAP_REGEX

Support for regular expression maps 

Table 26–3 Solaris Flags

Flag 

Description 

SUN_EXTENSIONS

Support for Sun extensions that are included in sun_compat.o.

SUN_LOOKUP_MACRO

Support for the L and G configuration commands in sendmail.cf. Use of these commands is not recommended.

SUN_DEFAULT_VALUES

Support only for the default values in the Solaris flag, SUN_CONTENT_LENGTH.

SUN_INIT_DOMAIN

For backward compatibility, support for the use of NIS domain names to fully qualify the local host name. For more information, look for vendor-specific information in http://www.sendmail.org.

SUN_CONTENT_LENGTH

Support for the Content-Length: header in messages to files. For more information, look for vendor-specific information in http://www.sendmail.org.

SUN_SIMPLIFIED_LDAP

Support for a simplified LDAP API, which is specific to Sun. For more information, look for vendor-specific information in http://www.sendmail.org.

VENDOR_DEFAULT=VENDOR_SUN

Selects Sun as the default vendor. 

The following table lists generic flags that are not used to compile the version of sendmail that is delivered with the Solaris 9 release.

Table 26–4 Generic Flags Not Used in the Solaris Version of sendmail

Flag 

Description 

SASL

Simple Authentication and Security Layer (RFC 2554) 

STARTTLS

Transaction Level Security (RFC 2487) 

To see a list of the flags that are used to compile sendmail, use the following command.


% /usr/lib/sendmail -bt -d0.10 < /dev/null

Note –

The preceding command does not list the flags that are specific to Sun.


Alternative sendmail Commands

The Solaris release does not include all of the command synonyms that are provided in the generic release from Berkeley. This table includes a complete list of the command aliases, whether they are included in the Solaris release, and how to generate the same behavior by using sendmail.

Table 26–5 Alternate sendmail Commands

Alternate Name 

In the Solaris Release? 

Options With sendmail

hoststat Nosendmail -bh
mailq Yessendmail -bp
newaliases Yessendmail -bi
purgestat Nosendmail -bH
smtpd Nosendmail -bd

Versions of the Configuration File

The Solaris 9 version of sendmail includes a configuration option that enables you to define the version of the sendmail.cf file. This option enables older configuration files to be used with the current version of sendmail. You can set the version level to values between 0 and 10. You can also define the vendor. Either Berkeley or Sun are valid vendor options. If a version level is specified but no vendor is defined, Sun is used as the default vendor setting. The following table lists some of the valid options.

Table 26–6 Configuration File Version Values

Field 

Description 

V7/Sun

Setting that was used for Version 8.8 of sendmail.

V8/Sun

Setting that was used for Version 8.9 of sendmail. This setting was included in the Solaris 8 release.

V9/Sun

Setting that was used for versions 8.10 and 8.11 of sendmail.

V10/Sun

Setting that is used for version 8.12 of sendmail. Version 8.12 is the default for the Solaris 9 release.


Note –

You are urged not to use V1/Sun. For more information, refer to http://www.sendmail.org/vendor/sun/differences.html#4.


For task information, refer to Building the sendmail.cf Configuration File (Task) in Chapter 25, Mail Services (Tasks).

Software and Hardware Components of Mail Services

This section describes the software and hardware components of a mail system.

Software Components

Each mail service includes at least one of each of the following software components.

This section also describes these software components.

Mail User Agent

The mail user agent is the program that acts as the interface between the user and mail transfer agent. The sendmail program is a mail transfer agent. The Solaris operating environment supplies the following mail user agents.

Mail Transfer Agent

The mail transfer agent is responsible for the routing of mail messages and the resolution of mail addresses. This agent is also known as a mail transport agent. The transfer agent for the Solaris operating environment is sendmail. The transfer agent performs these functions.

Local Delivery Agent

A local delivery agent is a program that implements a mail delivery protocol. The following local delivery agents are provided with the Solaris operating environment.

Chapter 27, What's New With Mail Services (Reference) provides information on these related topics.

Mailers

Mailer is a sendmail-specific term. A mailer is used by sendmail to identify a specific instance of a customized local delivery agent or a customized mail transfer agent. You need to specify at least one mailer in your sendmail.cf file. For task information, refer to Building the sendmail.cf Configuration File (Task) in Chapter 25, Mail Services (Tasks). This section provides a brief description of two types of mailers.

For additional information about mailers, see http://www.sendmail.org/m4/readme.html or /usr/lib/mail/README.

Simple Mail Transfer Protocol (SMTP) Mailers

SMTP is the standard mail protocol that is used on the Internet. This protocol defines these mailers.

UNIX-to-UNIX Copy Program (UUCP) Mailers

If possible, avoid using UUCP. For an explanation, refer to http://www.sendmail.org/m4/uucp.html or do a search in /usr/lib/mail/README on this string: USING UUCP MAILERS.

UUCP defines these mailers.

uucp-old

Names in the $=U class are sent to uucp-old. uucp is the obsolete name for this mailer. The uucp-old mailer uses an exclamation-point address in the headers.

uucp-new

Names in the $=Y class are sent to uucp-new. Use this mailer when you know that the receiving UUCP mailer can manage multiple recipients in one transfer. suucp is the obsolete name for this mailer. The uucp-new mailer also uses an exclamation-point address in the headers.

If MAILER(smtp) is also specified in your configuration, two more mailers are defined.

uucp-dom

This mailer uses domain-style addresses and, basically, applies the SMTP rewriting rules.

uucp-uudom

Names in the $=Z class are sent to uucp-uudom. uucp-uudom and uucp-dom use the same header address format, domain-style addresses.


Note –

Because the smtp mailer modifies the UUCP mailer, always put MAILER(smtp) before MAILER(uucp) in your .mc file.


Mail Addresses

The mail address contains the name of the recipient and the system to which the mail message is delivered. When you administer a small mail system that does not use a name service, addressing mail is easy. The login names uniquely identify the users. Complexity is introduced if you are administering a mail system that has more than one system with mailboxes or has one or more domains. Additional complexity can be generated if you have a UUCP (or other) mail connection to the outside world. The information in the following sections can help you understand the parts and complexities of a mail address.

Domains and Subdomains

Email addressing uses domains. A domain is a directory structure for network address naming. A domain can have one or more subdomains. The domain and subdomains of an address can be compared to the hierarchy of a file system. Just as a subdirectory is considered to be inside the directory above it, each subdomain in a mail address is considered to be inside the location to its right.

The following table shows some top-level domains.

Table 26–7 Top-Level Domains

Domain 

Description 

com

Commercial sites 

edu

Educational sites 

gov

United States government installations 

mil

United States military installations 

net

Networking organizations 

org

Other nonprofit organizations 

Domains are case insensitive. You can use uppercase, lowercase, or mixed-case letters in the domain part of an address without making any difference.

For more information about domains, refer to “Introduction to DNS (Overview)” in System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP).

Name Service Domain Name and Mail Domain Name

When you are working with name service domain names and mail domain names, remember the following.

For more information, refer to Interactions of sendmail With Name Services.

Typical Format for Mail Addresses

Typically, a mail address has the following format. For further details, refer to Route–Independent Mail Addresses.


user@subdomain. ... .subdomain2.subdomain1.top-level-domain

The part of the address to the left of the @ sign is the local address. The local address can contain the following.


Note –

The receiving mailer is responsible for determining what the local part of the address means. For information about mailers, refer to Mailers.


The part of the address to the right of the @ sign shows the domain levels, which is where the local address resides. A dot separates each subdomain. The domain part of the address can be an organization, a physical area, or a geographic region. Furthermore, the order of domain information is hierarchical—the more local the subdomain, the closer it is to the @ sign.

Route–Independent Mail Addresses

Mail addresses can be route independent. Route-independent addressing requires the sender of an email message to specify the name of the recipient and the final destination. A high-speed network, such as the Internet, uses route-independent addresses. Route-independent addresses can have this format.


user@host.domain

Route-independent addresses for UUCP connections can have this address format.


host.domain!user

The increased popularity of the domain-hierarchical naming scheme for computers is making route-independent addresses more common. Actually, the most common route-independent address omits the host name and relies on the domain name service to properly identify the final destination of the email message.


user@domain

Route-independent addresses are read by searching for the @ sign and then reading the domain hierarchy from the right (the highest level) to the left (the most specific part of the address to the right of the @ sign).

Mailbox Files

A mailbox is a file that is the final destination for email messages. The name of the mailbox can be the user name or the identity of a specific function, such as the postmaster. Mailboxes are in the /var/mail/username file, which can exist either on the user's local system or on a remote mail server. In either instance, the mailbox is on the system to which the mail is delivered.

Mail should always be delivered to a local file system so that the user agent can pull mail from the mail spool and store it readily in the local mailbox. Do not use NFS-mounted file systems as the destination for a user's mailbox. Specifically, do not direct mail to a mail client that is mounting the /var/mail file system from a remote server. Mail for the user, in this instance, should be addressed to the mail server and not to the client host name. NFS-mounted file systems can cause problems with mail delivery and handling.

The /etc/mail/aliases file and name services such as NIS and NIS+ provide mechanisms for creating aliases for electronic mail addresses so that users do not need to know the precise local name of a user's mailbox.

The following table shows some common naming conventions for special-purpose mailboxes.

Table 26–8 Conventions for the Format of Mailbox Names

Format 

Description 

username

User names are frequently the same as mailbox names. 

Firstname.Lastname Firstname_Lastname Firstinitial.Lastname Firstinitial_Lastname

User names can be identified as full names with a dot (or an underscore) that separates the first and last names, or by a first initial with a dot (or an underscore) that separates the initial and the last name. 

postmaster

Users can address questions and report problems with the mail system to the postmaster mailbox. Each site and domain should have a postmaster mailbox.

MAILER-DAEMON

sendmail automatically routes any mail that is addressed to the MAILER-DAEMON to the postmaster.

aliasname-request

Names that end in -request are administrative addresses for distribution lists. This address should redirect mail to the person who maintains the distribution list.

owner-aliasname

Names that begin with owner- are administrative addresses for distribution lists. This address should redirect mail to the person who handles mail errors.

owner-owner

This alias is used when no owner-aliasname alias exists for errors to be returned to. This address should redirect mail to the person who handles mail errors and should be defined on any system that maintains a large number of aliases.

local%domain

The percent sign (%) marks a local address that is expanded when the message arrives at its destination. Most mail systems interpret mailbox names with % characters as full mail addresses. The % is replaced with an @, and the mail is redirected accordingly. Although many people use the % convention, it is not a formal standard. This convention is referred to as the “percent hack.” This feature is often used to help debug mail problems.

Starting with sendmail version 8, the envelope sender for mail that is sent to a group alias has been changed to the address that is expanded from the owner alias, if an owner alias exists. This change enables any mail errors to be sent to the alias owner, rather than being returned to the sender. With this change, users notice that mail that was sent to an alias looks as if it came from the alias owner, when delivered. The following alias format helps with some of the problems that are associated with this change.


mygroup: :include:/pathname/mygroup.list
owner-mygroup: mygroup-request
mygroup-request: sandys, ignatz

In this example, the mygroup alias is the actual mail alias for the group. The owner-mygroup alias receives error messages. The mygroup-request alias should be used for administrative requests. This structure means that in mail sent to the mygroup alias, the envelope sender changes to mygroup-request.

Mail Aliases

An alias is an alternate name. For email, you can use aliases to assign a mailbox location or to define mailing lists. For a task map, refer to Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks). Also, you can refer to Mail Alias Files in this chapter.

For large sites, the mail alias typically defines the location of a mailbox. Providing a mail alias is like providing a room number as part of the address for an individual at a large corporation that occupies multiple rooms. If you do not provide the room number, the mail is delivered to a central address. Without a room number, extra effort is required to determine where within the building the mail is to be delivered, and the possibility of an error increases. For example, if two people who are named Kevin Smith are in the same building, only one of them might get mail. To correct the problem, each Kevin Smith should have a room number added to his address.

Use domains and location-independent addresses as much as possible when you create mailing lists. To enhance portability and flexibility of alias files, make your alias entries in mailing lists as generic and system independent as possible. For example, if you have a user who is named ignatz on system mars, in domain example.com, create the alias ignatz@example instead of ignatz@mars. If user ignatz changes the name of his system but remains within the example domain, you do not need to update alias files to reflect the change in system name.

When you create alias entries, type one alias per line. You should have only one entry that contains the user's system name. For example, you could create the following entries for user ignatz.


ignatz: iggy.ignatz
iggyi: iggy.ignatz
iggy.ignatz: ignatz@mars

You can create an alias for local names or domains. For example, an alias entry for user fred, who has a mailbox on the system mars and is in the domain planets, could have this entry in the NIS+ aliases table.


fred: fred@planets

When you create mail lists that include users outside your domain, create the alias with the user name and the domain name. For example, if you have a user named smallberries on system privet, in domain example.com, create the alias as smallberries@example.com. The email address of the sender is now automatically translated to a fully qualified domain name when mail goes outside the user's domain.

The following list describes methods for creating and administering mail alias files.

Hardware Components

You can provide the three required elements of mail configuration in the same system or have separate systems provide these elements.

When users are to communicate with networks outside your domain, you must also add a fourth element, a mail gateway. For more information, refer to Mail Gateway. The following sections describe each hardware component.

Mail Host

A mail host is the machine that you designate as the main mail machine on your network. A mail host is the machine to which other systems at the site forward mail that they cannot deliver. You designate a system as a mail host in the hosts database by adding the word mailhost to the right of the IP address in the local /etc/hosts file or in the hosts file in the name service. You must also use the main.cf file as the mail configuration file on the mail host system. For detailed task information, refer to How to Set Up a Mail Host in Chapter 25, Mail Services (Tasks).

A good candidate for a mail host is a system on the local area network that also has a modem for setting up PPP or UUCP links over telephone lines. Another good candidate is a system that is configured as a router from your network to the Internet global network. For more information, refer to Chapter 29, Solaris PPP 4.0 (Overview), Chapter 38, Overview of UUCP, and “Configuring Routers” in System Administration Guide: IP Services. If none of the systems on your local network has a modem, designate one as the mail host.

Some sites use standalone machines that are not networked in a time-sharing configuration. That is, the standalone machine serves terminals that are attached to its serial ports. You can set up electronic mail for this configuration by designating the standalone system as the mail host of a one-system network. Overview of the Hardware Components in Chapter 24, Mail Services (Overview) provides a figure that shows a typical email configuration.

Mail Server

A mailbox is a single file that contains email for a particular user. Mail is delivered to the system where the user's mailbox resides, which can be on a local machine or a remote server. A mail server is any system that maintains user mailboxes in its /var/mail directory. For task information, refer to How to Set Up a Mail Server in Chapter 25, Mail Services (Tasks).

The mail server routes all mail from a client. When a client sends mail, the mail server puts it in a queue for delivery. After the mail is in the queue, a user can reboot or turn off the client without losing those mail messages. When the recipient gets mail from a client, the path in the "From " line of the message contains the name of the mail server. If the recipient responds, the response goes to the user's mailbox. Good candidates for mail servers are systems that provide a home directory for users or systems that are backed up regularly.

If the mail server is not the user's local system, users in configurations that use NFS software can mount the /var/mail directory by using the /etc/vfstab file (if they have root access) or by using the automounter. If NFS support is not available, users can log in to the server to read their mail.

If users on your network send other types of mail, such as audio files or files from desktop publishing systems, you need to allocate more space on the mail server for mailboxes.

One advantage to establishing a mail server for all mailboxes is that it simplifies backups. Backups can be difficult to do when mail is spread over many systems. The disadvantage of storing many mailboxes on one server is that the server can be a single point of failure for many users. However, the advantages of providing good backups usually make the risk worthwhile.

Mail Client

A mail client is any system that receives mail on a mail server and does not have a local /var/mail directory. This type of configuration is known as remote mode. Remote mode is enabled by default in /etc/mail/subsidiary.cf.

You must check that the mail client has the appropriate entry in the /etc/vfstab file and a mount point to mount the mailbox from the mail server. Also, ensure that the alias for the client is directed to the mail server's host name, not to the client's name. For task information, refer to How to Set Up a Mail Client in Chapter 25, Mail Services (Tasks).

Mail Gateway

The mail gateway is a machine that handles connections between networks that run different communications protocols or communications between different networks that use the same protocol. For example, a mail gateway might connect a TCP/IP network to a network that runs the Systems Network Architecture (SNA) protocol suite.

The simplest mail gateway to set up is one that connects two networks that use the same protocol or mailer. This system handles mail with an address for which sendmail cannot find a recipient in your domain. If a mail gateway exists, sendmail uses it for sending and receiving mail outside your domain.

You can set up a mail gateway between two networks that use unmatched mailers, as shown in the next figure. To support this configuration, you must customize the sendmail.cf file on the mail gateway system, which can be a difficult and time-consuming process.

Figure 26–1 Gateway Between Different Communications Protocols

Graphic

If you have to set up a mail gateway, you should find a gateway configuration file that is close to what you need and modify it to conform to your situation.

If you have a machine that provides connections to the Internet, you can configure that machine as the mail gateway. Carefully consider your site's security needs before you configure a mail gateway. You might need to create a firewall gateway between your corporate network and the outside world, and set up that gateway as the mail gateway. For task information, refer to How to Set Up a Mail Gateway in Chapter 25, Mail Services (Tasks).

Mail Service Programs and Files

Mail services include many programs and daemons that interact with each other. This section introduces the files, programs, terms, and concepts that are related to administering electronic mail.

Contents of the /usr/bin Directory

The following table shows the contents of the /usr/bin directory, which is used for mail services.

Name 

Type 

Description 

aliasadm

File 

A program to manipulate the NIS+ aliases map. 

mail

File 

A user agent. 

mailcompat

File 

A filter to store mail in SunOS 4.1 mailbox format. 

mailq

Link 

A link to /usr/lib/sendmail. Used to list the mail queue.

mailstats

File 

A program that is used to read mail statistics that are stored in the /etc/mail/sendmail.st file (if present).

mailx

File 

A user agent. 

mconnect

File 

A program that connects to the mailer for address verification and debugging. 

praliases

File 

A command to “uncompile” the alias database. Refer to the uncompile information that is provided in the man page for praliases(1).

rmail

Link 

A link to /usr/bin/mail. Command that is often used to permit only the sending of mail.

vacation

File 

A command to set up an automatic reply to mail. 

Contents of the /etc/mail Directory

The following table shows the contents of the /etc/mail directory.

Name 

Type 

Description 

Mail.rc

File 

Default settings for the mailtool user agent.

aliases

File 

Mail-forwarding information. 

aliases.db

File 

Default binary form of mail-forwarding information (created by running newaliases).

aliases.dir

File 

Binary form of mail-forwarding information (created by running newaliases). Can still be used, but is no longer used by default in the Solaris 9 release.

aliases.pag

File 

Binary form of mail-forwarding information (created by running newaliases). Can still be used, but is no longer used by default in the Solaris 9 release.

mailx.rc

File 

Default settings for the mailx user agent.

main.cf

File 

Sample configuration file for main systems. 

relay-domains

File 

List of all domains for which relaying is allowed. By default, only the local domain is allowed. 

sendmail.cf

File 

Configuration file for mail routing. 

submit.cf

File 

New configuration file for the mail submission program (MSP). For more information, refer to New Configuration File, submit.cf.

local-host-names

File 

Optional file that you can create if the number of aliases for the mail host is too long. 

helpfile

File 

Help file that is used by the SMTP HELP command.

sendmail.pid

File 

File that lists the PID of the listening daemon and is now in /var/run.

sendmail.st

File 

sendmail statistics file. If this file is present, sendmail logs the amount of traffic through each mailer.

subsidiary.cf

File 

Sample configuration file for subsidiary systems. 

trusted-users

File 

File that lists the users (one per line) who can be trusted to perform certain mail operations. By default, only root is in this file. Certain mail operations, when performed by untrusted users, result in the following warning, X-Authentication-Warning: header being added to a message.

Contents of the /usr/lib Directory

Table 26–9 shows the contents of the /usr/lib directory, which is used for mail services.

Table 26–9 Contents of the /usr/lib Directory

Name 

Type 

Description 

mail.local

File 

Mailer that delivers mail to mailboxes. 

sendmail

File 

Routing program, also known as the mail transfer agent. 

smrsh

File 

Shell program (sendmail restricted shell) that uses the “|program” syntax of sendmail to restrict programs that sendmail can run to those programs listed in the /var/adm/sm.bin directory. Refer to the smrsh(1M) man page for recommendations on what to include in /var/adm/sm.bin. To enable, include this m4 command, FEATURE(`smrsh'), in your mc file.

Contents of the /usr/lib/mail Directory

Within the /usr/lib directory is a subdirectory, mail, that contains all of the necessary files to build a sendmail.cf file. The contents of mail are shown in Table 26–10.

Table 26–10 Contents of the /usr/lib/mail Directory Used for Mail Services

Name 

Type 

Description 

README

File 

Describes the configuration files. 

cf

Directory 

Provides site-dependent and site-independent descriptions of hosts. 

cf/main.mc

File 

Previously named cf/main-v7sun.mc. Is the main configuration file.

cf/makefile

File 

Provides rules for building new configuration files. 

cf/submit.mc

File 

Is the configuration file for the mail submission program (MSP), which is used to submit messages. 

cf/subsidiary.mc

File 

Previously named cf/subsidiary-v7sun.mc. Is the configuration file for hosts that NFS-mount /var/mail from another host.

domain

Directory 

Provides site-dependent subdomain descriptions. 

domain/generic.m4

File 

Is the generic domain file from Berkeley. 

domain/solaris-antispam.m4

File 

Is the domain file with changes that make sendmail function like previous Solaris versions. However, relaying is disabled completely, sender addresses with no host name are rejected, and unresolvable domains are rejected.

domain/solaris-generic.m4

File 

Is the default domain file with changes that make sendmail function like previous Solaris versions.

feature

Directory 

Contains definitions of specific features for particular hosts (see README for a full description of the features).

m4

Directory 

Contains site-independent include files. 

mailer

Directory 

Contains definitions of mailers, which include local, smtp, and uucp.

ostype

Directory 

Describes various operating system environments. 

ostype/solaris2.m4

File 

Defines default local mailer as mail.local.

ostype/solaris2.ml.m4

File 

Defines default local mailer as mail.local.

ostype/solaris2.pre5.m4

File 

Defines local mailer as mail.

ostype/solaris8.m4

File 

Defines local mailer as mail.local (in LMTP mode), enables IPv6, specifies /var/run as the directory for the sendmail.pid file.

sh

Directory 

Contains shell scripts that are used by the m4 build process and migration aids.

sh/check-permissions

File 

Checks permissions of :include: aliases and .forward files and their parent directory path for correct permissions.

sh/check-hostname

File 

Verifies that sendmail is able to determine the fully qualified host name.

Other Files Used for Mail Services

Several other files and directories are used for mail services, as shown in Table 26–11.

Table 26–11 Other Files Used for Mail Services

Name 

Type 

Description 

sendmailvars.org_dir

Table 

NIS+ version of sendmailvars file.

/etc/default/sendmail

File 

Lists the environment variables for the startup script for sendmail.

/etc/shells

File 

Lists the valid login shells. 

/usr/sbin/editmap

File 

Queries and edits single records in database maps for sendmail.

/usr/sbin/in.comsat

File 

Mail notification daemon. 

/usr/sbin/makemap

File 

Builds binary forms of keyed maps. 

/usr/sbin/newaliases

Link 

A link to /usr/lib/sendmail. Used to create the binary form of the alias database. Previously in /usr/bin.

/usr/sbin/syslogd

File 

Error message logger, used by sendmail.

/usr/sbin/etrn

File 

Perl script for starting the client-side remote mail queue. 

/usr/dt/bin/dtmail

File 

CDE mail user agent. 

/var/mail/mailbox1, /var/mail/mailbox2

File 

Mailboxes for delivered mail. 

/var/spool/clientmqueue

Directory 

Storage for mail that is delivered by the client daemon. 

/var/spool/mqueue

Directory 

Storage for mail that is delivered by the master daemon. 

$OPENWINHOME/bin/mailtool

File 

Window–based mail user agent. 

/var/run/sendmail.pid

File 

File that lists the PID of the listening daemon. 

Interactions of Mail Programs

Mail services are provided by a combination of the following programs, which interact as shown in the simplified illustration in Figure 26–2.

Figure 26–2 Interactions of Mail Programs

Graphic

For a more detailed illustration, refer to the figure in sendmail Features.

The following is a description of the interactions of mail programs.

  1. Users send messages by using programs such as mailx or mailtool. See the man pages for mailx(1) or mailtool(1) for information about these programs.

  2. The message is collected by the program that generated it and is passed to the sendmail daemon.

  3. The sendmail daemon parses the addresses (divides them into identifiable segments) in the message. The daemon uses information from the configuration file, /etc/mail/sendmail.cf, to determine network name syntax, aliases, forwarding information, and network topology. By using this information, sendmail determines the route a message must follow to get to a recipient.

  4. The sendmail daemon passes the message to the appropriate system.

  5. The /usr/lib/mail.local program on the local system delivers the mail to the mailbox in the /var/mail/username directory of the recipient of the message.

  6. The recipient is notified that mail has arrived and retrieves it by using mail, mailx, mailtool, or a similar program.

sendmail Program

The following list describes some of the capabilities of the sendmail program.

The Solaris operating environment uses the sendmail program as a mail router. The following list describes some of its functions.

For more information about the sendmail program, refer to the following topics.

sendmail and Its Rerouting Mechanisms

The sendmail program supports three mechanisms for mail rerouting. The mechanism you choose depends on the type of change that is involved.

Additionally, the rerouting mechanism you choose can affect the level of administration that is required. Consider the following options.

  1. One rerouting mechanism is aliasing.

    Aliasing can map names to addresses on a server-wide basis or a name service-wide basis, depending on the type of file that you use.

    Consider the following advantages and disadvantages for name service aliasing.

    • The use of a name service (such as NIS or NIS+) alias file permits mail rerouting changes to be administered from a single source. However, name service aliasing can create lag time when the rerouting change is propagated.

    • Name service administration is usually restricted to a select group of system administrators. A normal user would not administer this file.

    Consider the following advantages and disadvantages for using a server alias file.

    • By using a server alias file, rerouting can be managed by anyone who can become root on the designated server.

    • Server aliasing should create little or no lag time when the rerouting change is propagated.

    • The change only affects the local server, which might be acceptable if most of the mail is sent to one server. However, if you need to propagate this change to many mail servers, use a name service.

    • A normal user would not administer this change.

    For more information, refer to Mail Alias Files in this chapter. For a task map, refer to Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks).

  2. The next mechanism is forwarding.

    This mechanism permits users to administer mail rerouting. Local users can reroute their incoming mail to the following.

    • Another mailbox

    • A different mailer

    • Another mail host

    This mechanism is supported through the use of .forward files. For more information about these files, refer to .forward Files in this chapter. For a task map, refer to Administering .forward Files (Task Map) in Chapter 25, Mail Services (Tasks).

  3. The last rerouting mechanism is inclusion.

    This mechanism allows users to maintain alias lists, instead of requiring root access. To provide this feature, the root user must create an appropriate entry in the alias file on the server. After this entry is created, the user can reroute mail as necessary. For more information on inclusion, refer to /etc/mail/aliases File in this chapter. For a task map, refer to Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks).

Figure 26–3 shows how sendmail uses aliases. Programs that read mail, such as /usr/bin/mailx, can have aliases of their own, which are expanded before the message reaches sendmail. The aliases for sendmail can originate from a number of name service sources (local files, NIS or NIS+). The order of the lookup is determined by the nsswitch.conf file. Refer to the nsswitch.conf(4) man page.

Figure 26–3 How sendmail Uses Aliases

Graphic

sendmail Features

The sendmail program provides the following features.

Figure 26–4 shows how sendmail interacts with the other programs in the mail system.

Figure 26–4 Interaction of sendmail With Other Mail Programs

Graphic

As shown in Figure 26–4, the user interacts with a mail-generating and mail-sending program. When the mail is submitted, the mail-generating program calls sendmail, which routes the message to the correct mailers. Because some of the senders might be network servers and some of the mailers might be network clients, you can use sendmail as an Internet mail gateway. See Interactions of Mail Programs for a more detailed description of the process.

sendmail Configuration File

A configuration file controls the way that sendmail performs its functions. The configuration file determines the choice of delivery agents, address rewriting rules, and the format of the mail header.

The sendmail program uses the information from the /etc/mail/sendmail.cf file to perform its functions. Each system has a default sendmail.cf file that is installed in the /etc/mail directory. You do not need to edit or change the default configuration file for mail servers or mail clients. The only systems that require a customized configuration file are mail hosts and mail gateways.

The Solaris operating environment provides three default configuration files in the /etc/mail directory.

  1. A configuration file that is named main.cf for the system (or systems) you designate as the mail host or a mail gateway

  2. A configuration file that is named subsidiary.cf, which is a duplicate copy of the default sendmail.cf file

  3. A configuration file that is named submit.cf, which is used to run sendmail in mail submission program mode, instead of daemon mode. For more information, refer to New Configuration File, submit.cf.

The configuration file you use on a system depends on the role of the system in your mail service.

The following list describes some configuration parameters you can change, depending on the requirements of your site.

Mail Alias Files

You can use any of the following files, maps, or tables to maintain aliases.

Your method of maintaining aliases depends on who uses the alias and who needs to be able to change the alias. Each type of alias has unique format requirements.

If you are looking for task information, refer to Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks).

.mailrc Aliases

Aliases that are listed in a .mailrc file are accessible only by the user who owns the file. This restriction enables users to establish an alias file they control and that is usable only by its owner. Aliases in a .mailrc file adhere to the following format.


alias aliasname value value value ...

aliasname is the name that the user uses when sending mail, and value is a valid email address.

If a user establishes a personal alias for scott that does not match the email address for scott in the name service, mail is routed to the wrong person when people try to reply to mail that is generated by this user. The only workaround is to use any of the other aliasing mechanisms.

/etc/mail/aliases File

Any alias that is established in the /etc/mail/aliases file can be used by any user who knows the name of the alias and the host name of the system that contains the file. Distribution list formats in a local /etc/mail/aliases file adhere to the following format.


aliasname: value,value,value ...

aliasname is the name that the user uses when sending mail to this alias, and value is a valid email address.

If your network is not running a name service, the /etc/mail/aliases file of each system should contain entries for all mail clients. You can either edit the file on each system or edit the file on one system and copy it to each of the other systems.

The aliases in the /etc/mail/aliases file are stored in text form. When you edit the /etc/mail/aliases file, you need to run the newaliases program to recompile the database and make the aliases available in binary form to the sendmail program. For task information, refer to How to Set Up a Local Mail Alias File in Chapter 25, Mail Services (Tasks). Otherwise, you can use the AdminTool's Database Manager to administer the mail aliases that are stored in the local /etc files.

You can create aliases for only local names—a current host name or no host name. For example, an alias entry for user ignatz who has a mailbox on the system saturn would have the following entry in the /etc/mail/aliases file.


ignatz: ignatz@saturn

You should create an administrative account for each mail server. You create such an account by assigning a mailbox on the mail server to root and by adding an entry for root to the /etc/mail/aliases file. For example, if the system saturn is a mailbox server, add the entry root: sysadmin@saturn to the /etc/mail/aliases file.

Normally, only the root user can edit this file. However, when you use the Administration Tool, all users in group 14, which is the sysadmin group, can change the local file. Another option is to create the following entry.


aliasname: :include:/path/aliasfile

aliasname is the name that the user uses when sending mail, and /path/aliasfile is the full path to the file that contains the alias list. The alias file should include email entries, one entry on each line, and no other notations.


user1@host1
user2@host2

You can define additional mail files in /etc/mail/aliases to keep a log or a backup copy. The following entry stores all mail that is sent to aliasname in filename.


aliasname: /home/backup/filename

You can also route the mail to another process. The following example stores a copy of the mail message in filename and prints a copy.


aliasname: "|tee -a /home/backup/filename |lp"

For a task map, refer to Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks).

NIS aliases Map

All users in a local domain can use the entries that are in the NIS aliases map, because the sendmail program can use the NIS aliases map instead of the local /etc/mail/aliases files to determine mailing addresses. For more information, refer to the nsswitch.conf(4) man page.

Aliases in the NIS aliases map adhere to the following format.


aliasname: value,value,value ...

aliasname is the name that the user uses when sending mail, and value is a valid email address.

The NIS aliases map should contain entries for all mail clients. In general, only the root user on the NIS master can change these entries. This type of alias might not be a good choice for aliases that are constantly changing, but such aliases can be useful if the aliases point to another alias file, as in the following syntax example.


aliasname: aliasname@host

aliasname is the name that the user uses when sending mail, and host is the host name for the server that contains an /etc/mail/alias file.

For task information, refer to How to Set Up an NIS mail.aliases Map in Chapter 25, Mail Services (Tasks).

NIS+ mail_aliases Table

The NIS+ mail_aliases table contains the names by which a system or person is known in the local domain. The sendmail program can use the NIS+ mail_aliases table, instead of the local /etc/mail/aliases files, to determine mailing addresses. Refer to the aliasadm(1M) and nsswitch.conf(4) man pages for more information.

Aliases in the NIS+ mail_aliases table adhere to the following format:


alias: expansion # ["options	" # "comments"]

Table 26–12 describes the four columns that are in an NIS+ mail_aliases table.

Table 26–12 Columns in the NIS+ mail_aliases Table

Column 

Description 

alias

The name of the alias 

expansion

The value of the alias or a list of aliases as it would appear in a sendmail /etc/mail/aliases file

options

The column that is reserved for future use 

comments

The column for comments about an individual alias 

The NIS+ mail_aliases table should contain entries for all mail clients. You can list, create, modify, and delete entries in the NIS+ aliases table with the aliasadm command. To use the aliasadm command, you must be a member of the NIS+ group that owns the aliases table. For task information, refer to How to Manage Alias Entries in an NIS+ mail_aliases Table in Chapter 25, Mail Services (Tasks). Alternately, you can use the AdminTool's Database Manager to administer the NIS+ mail aliases.


Note –

If you are creating a new NIS+ aliases table, you must initialize the table before you create the entries. If the table exists, no initialization is needed.


.forward Files

Users can create a .forward file in their home directories that sendmail, along with other programs, can use to redirect mail or send mail. Refer to the following topics.

For a task map, refer to Administering .forward Files (Task Map) in Chapter 25, Mail Services (Tasks).

Situations to Avoid

The following list describes some situations that you can avoid or easily fix.

Controls for .forward files

For the .forward files to be an effective part of mail delivery, ensure that the following controls (mostly permissions settings) are correctly applied.

.forward.hostname File

You can create a .forward.hostname file to redirect mail that is sent to a specific host. For example, if a user's alias has changed from sandy@phoenix.example.com to sandy@example.com, place a .forward.phoenix file in the home directory for sandy.


% cat .forward.phoenix
sandy@example.com
"|/usr/bin/vacation sandy"
% cat .vacation.msg
From: sandy@example.com (via the vacation program)
Subject: my alias has changed

My alias has changed to sandy@example.com.
Please use this alias in the future.
The mail that I just received from you
has been forwarded to my new address.

Sandy

In this example, mail can be forwarded to the correct place while the sender is notified of the alias change. Because the vacation program permits only one message file, you can forward only one message at a time. However, if the message is not host specific, one vacation message file can be used by .forward files for many hosts.

.forward+detail File

Another extension to the forwarding mechanism is the .forward+detail file. The detail string can be any sequence of characters except operator characters. The operator characters are .:%&!^[]+. By using this type of file, you can determine if someone else is using your email address without your knowledge. For instance, if a user tells someone to use the email address sandy+test1@example.com, the user would be able to identify any future mail that was delivered to this alias. By default, any mail that is sent to the sandy+test1@example.com alias is checked against the alias and the .forward+detail files. If no matches are made, the mail falls back to delivery to sandy@example.com, but the user is able to see a change in the To: mail header.

/etc/default/sendmail File

This file is used to store startup options for sendmail so that they are not removed when a host is upgraded. The following variables can be used.

CLIENTOPTIONS=“string

Selects additional options to be used with the client daemon, which looks in the client-only queue (/var/spool/clientmqueue) and acts as a client queue runner. No syntax checking is done, so be careful when making changes to this variable.

CLIENTQUEUEINTERVAL=#

Similar to the QUEUEINTERVAL option, CLIENTQUEUEINTERVAL sets the time interval for mail queue runs. However, the CLIENTQUEUEINTERVAL option controls the functions of the client daemon, instead of the master daemon. Typically, the master daemon is able to deliver all messages to the SMTP port. However, if the message load is too high or the master daemon is not running, then messages go into the client-only queue, /var/spool/clientmqueue. The client daemon, which checks in the client-only queue, then acts as a client queue processor.

ETRN_HOSTS=“string

Enables an SMTP client and server to interact immediately without waiting for the periodic queue run intervals. The server can immediately deliver the portion of its queue that goes to the specified hosts. For more information, refer to the etrn(1M) man page.

MODE=-bd

Selects the mode to start sendmail with. Use the -bd option or leave it undefined.

OPTIONS=string

Selects additional options to be used with the master daemon. No syntax checking is done, so be careful when making changes to this variable.

QUEUEINTERVAL=#

Sets the interval for mail queue runs on the master daemon. # can be a positive integer that is followed by either s for seconds, m for minutes, h for hours, d for days, or w for weeks. The syntax is checked before sendmail is started. If the interval is negative or if the entry does not end with an appropriate letter, the interval is ignored and sendmail starts with a queue interval of 15 minutes.

QUEUEOPTIONS=p

Enables one persistent queue runner that sleeps between queue run intervals, instead of a new queue runner for each queue run interval. You can set this option to p, which is the only setting available. Otherwise, this option is not set.

Mail Addresses and Mail Routing

The path a mail message follows during delivery depends on the setup of the client system and the topology of the mail domain. Each additional level of mail hosts or mail domains can add another alias resolution, but the routing process is basically the same on most hosts.

You can set up a client system to receive mail locally. Receiving mail locally is known as running sendmail in local mode. Local mode is the default for all mail servers and some clients. On a mail server or a mail client in local mode, a mail message is routed the following way.


Note –

The following example assumes that you are using the default rule set in the sendmail.cf file.


  1. Expand the mail alias, if possible, and restart the local routing process.

    The mail address is expanded by checking for the mail alias in the name service and substituting the new value, if one is found. This new alias is then checked again.

  2. If the mail is local, deliver it to /usr/lib/mail.local.

    The mail is delivered to a local mailbox.

  3. If the mail address includes a host in this mail domain, deliver the mail to that host.

  4. If the address does not include a host in this domain, forward the mail to the mail host.

    The mail host uses the same routing process as the mail server, but the mail host can receive mail that is addressed to the domain name as well as to the host name.

Interactions of sendmail With Name Services

This section describes domain names as they apply to sendmail and name services, as well as the rules for effective use of name services, and the specific interactions of sendmail with name services. For details, refer to the following topics.

If you are looking for related task information, refer to How to Use DNS With sendmail or Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks).

sendmail.cf and Mail Domains

The standard sendmail.cf file uses mail domains to determine whether mail is delivered directly or through a mail host. Intradomain mail is delivered through a direct SMTP connection, while interdomain mail is forwarded to a mail host.

In a secure network, only a few selected hosts are authorized to generate packets that are targeted to external destinations. Even if a host has the IP address of the remote host that is external to the mail domain, the establishment of an SMTP connection is not guaranteed. The standard sendmail.cf assumes the following.

With these assumptions, the mail host is responsible for delivering or forwarding interdomain mail.

sendmail and Name Services

sendmail imposes various requirements on name services. To improve your understanding of these requirements, this section first describes the relationship of mail domains to name service domains. Then the section describes the various requirements. Refer to the following.

Mail Domains and Name Service Domains

The mail domain name must be a suffix of the name service domain. For example, if the domain name of the name service is A.B.C.D, the mail domain name could be one of the following.

When first established, the mail domain name is often identical to the name service domain. As the network grows, the name service domain can be divided into smaller pieces to make the name service more manageable. However, the mail domain often remains undivided to provide consistent aliasing.

Host Name Service Data

This section describes the requirements that sendmail imposes on name services.

A host table or map in a name service must be set up to support three types of gethostbyname() queries.

Two additional rules about the host-name service need to be followed to establish efficient sendmail services within a name service.

For more information about the gethostbyname() function, refer to the gethostbyname(3NSL) man page.

Interactions of NIS and sendmail

The following list describes the interactions of sendmail and NIS and provides some guidance.

For task information, refer to Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks).

Interactions of sendmail With NIS and DNS

The following list describes the interactions of sendmail with NIS and DNS and provides some guidance.

For task information, refer to How to Use DNS With sendmail and Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks).

Interactions of NIS+ and sendmail

The following list describes the interactions of sendmail with NIS+ and provides some guidance.

For task information, refer to Administering Mail Alias Files (Task Map) in Chapter 25, Mail Services (Tasks).

Interactions of sendmail With NIS+ and DNS

The following list describes the interactions of sendmail with NIS+ and DNS and provides some guidance.

For task information, refer to Administering Mail Alias Files (Task Map) and How to Use DNS With sendmail in Chapter 25, Mail Services (Tasks).