HPlogo HP-UX Mailing Services Administrator's Guide: HP-UX 11i v1 and HP-UX 11i v2 > Chapter 2 Configuring and Administering Sendmail

Configuring Sendmail

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

Sendmail is packaged with the core HP-UX 11i v2 operating system. When you install the operating system, Sendmail is automatically installed on your system. The necessary files required for Sendmail operation are created or modified on your system. The Sendmail configuration file supplied with the operating system, sendmail.cf, will work without modifications for most installations.

Therefore, you only need to perform a few tasks to configure Sendmail:

  • Set up Sendmail servers to run with NFS.

  • Configure and start Sendmail clients.

  • Verify that Sendmail is running properly.

This section discusses the following topics:

NOTE: HP recommends that you use Sendmail with the BIND name server. The BIND name server must have a mail exchanger (MX) record for every host in every domain that it serves. For more information on how Sendmail uses MX records, see “Mail Exchanger (MX) Records”.

Configuring Sendmail on a Standalone System

When Sendmail is installed, it is automatically configured to send and receive mail messages for users on the local system only. The standalone system processes all outbound mail and establishes connections to the message destination host or to the MX hosts. Because the Sendmail daemon is invoked automatically when a system is rebooted, no system files need to be modified.

The installation script makes the following configuration changes:

  • Sets the SENDMAIL_SERVER variable in the /etc/rc.config.d/mailservs file to 1. This ensures that the Sendmail daemon is started whenever you reboot your system or run the Sendmail startup script.

  • Creates /etc/mail/sendmail.cf and /etc/mail/aliases files with default configurations. These files are created with root as the owner and other as the group. The permission for /etc/mail/aliases and /etc/mail/sendmail.cf is set to 0640 and 0444, respectively.

    NOTE: If the /etc/mail/sendmail.cf file already exists, the existing file is saved to /etc/mail/#sendmail. If the /etc/mail/aliases file already exists, the Sendmail installation script does not recreate the aliases file.
  • Creates the /etc/mail/sendmail.cw file that contains the host name and the fully qualified host name for the system. For example, the system dog in the domain hp.com contains the following entries in the sendmail.cw file:

    dog
    dog.hp.com
  • Finally, the installation script issues the following command to run the Sendmail startup script:

    /sbin/init.d/sendmail start

    The Sendmail startup script generates the aliases database from the /etc/mail/aliases source file. The generated database is located in the /etc/mail/aliases.db file.

    The Sendmail startup script then invokes the Sendmail daemon by issuing the following command:

    /usr/sbin/sendmail  -bd  -q30m

    By using the -q30m option, Sendmail processes the mail queue every 30 minutes.

    For more information about Sendmail’s command line options, type man 1M sendmail at the HP-UX prompt.

Configuring Sendmail on a Mail Server

This section describes how to configure a system to allow users on other (client) systems to use Sendmail.

The mail server receives mail for local users and for the users on client systems. Users on client systems mount the mail directory from the server and read or access mail over an NFS link. For more information on how Sendmail clients and servers work, see “Default Client/Server Operation”.

The Sendmail installation script performs the configuration changes that are described in “Configuring Sendmail on a Standalone System”. To set up the system as an NFS server and allow the Sendmail clients to read and write to the /var/mail directory, do the following:

  1. Ensure that all mail users have accounts on the mail server and that their user IDs and group IDs on the mail server are the same as on the client machines. (This step is not necessary if you are using NIS or NIS+ and your mail server is in the same NIS or NIS+ domain as the clients.)

  2. Use a text editor to set the NFS_SERVER variable to 1 in the /etc/rc.config.d/nfsconf file.

  3. Use a text editor to add the following line to the /etc/exports file:

    /var/mail  -access=client1,client2, ...

    where each mail client is listed in the access list. If the /etc/exports file does not exist, you must create it.

  4. Issue the following command to run the NFS startup script:

    /sbin/init.d/nfs.server  start

For more information on NFS, see Installing and Administering NFS Services, at the URL http://www.docs.hp.com/hpux/onlinedocs/B1031-90048/B1031-90048.html.

Configuring Sendmail on a Mail Client

Sendmail clients do not receive mail on their local system, but receive mail on the mail server. User mail directories reside on the server, and users read their mail over an NFS link. By default, a Sendmail client forwards to the server any local mail (a user address destined for the client system) and sends nonlocal mail directly to the destination system or MX host. An outgoing mail message appears to originate from the server, so replies are sent back to the server. For more information on how Sendmail clients and servers work, see “Default Client/Server Operation”. Sendmail clients can be diskless systems.

To configure a Sendmail client system, do the following:

  1. Use a text editor to set the SENDMAIL_SERVER variable to 0 in the /etc/rc.config.d/mailservs file. This ensures that the Sendmail daemon will not be started when you reboot your system or run the Sendmail startup script.

  2. Set the SENDMAIL_SERVER_NAME variable in the /etc/rc.config.d/mailservs file to the host name or to the IP address of the mail server you will use (the machine that will run the Sendmail daemon).

  3. Set the NFS_CLIENT variable to 1 in the /etc/rc.config.d/nfsconf file.

  4. Add the following line in the /etc/fstab file:

    servername:/var/mail  /var/mail  nfs  0  0

    where servername is the name configured in the SENDMAIL_SERVER_NAME variable in /etc/rc.config.d/mailservs. If the /etc/fstab file does not exist, you must create it.

  5. Issue the following command to run the Sendmail startup script:

    /sbin/init.d/sendmail start
  6. Issue the following command to run the NFS startup script:

    /sbin/init.d/nfs.client start

The Sendmail startup script assumes that this system will use the host specified by the SENDMAIL_SERVER_NAME variable as the mail hub. The script also assumes that mail sent from this system appears to be from the host specified by the SENDMAIL_SERVER_NAME variable (this feature may previously have been known as site hiding). The script therefore modifies the macros DM (for masquerade) and DH (for mail hub) in the system’s /etc/mail/sendmail.cf file to use the host specified by the SENDMAIL_SERVER_NAME variable. If the DM and DH macros have been defined previously, the startup script does not modify them.

The client system now forwards local mail to the mail server and forwards other mail directly to remote systems. To configure the client system to relay all mail to the mail server for delivery, see “Modifying the Default Sendmail Configuration File”.

The NFS startup script mounts the /var/mail directory from the mail server to your system.

Verifying your Sendmail Installation

This section provides information on how to verify your Sendmail installation. It discusses the following topics:

Sending Mail to a Local User

To check your local mailer or user agent, send a mail message to a local user (for example, joe) on your system:

date  |  mailx  -s  "Local sendmail Test"  joe

This must result in a message similar to the following being sent to user joe:

From joe Wed Aug 6 09:18 MDT 2002
Received: by node2; Wed, 6 Aug 02 09:18:53 mdt
Date: Wed, 6 Aug 02 09:18:53 mdt
From: Joe User <joe>
Return-Path: <joe>
To: joe
Subject: Local sendmail Test

Wed Aug 6 09:18:49 MDT 2002

An entry in your /var/adm/syslog/mail.log file must have been logged for the local message transaction. See “Configuring and Reading the Sendmail Log” for more information.

Using UUCP Addressing to Send Mail to a Remote User

If you are using UUCP addressing, you can verify your Sendmail installation by sending a mail message to a remote user with UUCP transport by using a host !user address, where host is a system to which your local host has a direct UUCP connection. (The uuname command lists the UUCP names of known systems. Type man 1 uuname at the HP-UX prompt for more information.)

To verify both inbound and outbound UUCP connections, mail the message in a loop, using the syntax remote_host !my_host !user. For example, if you execute the following command:

date | mailx -s “UUCP Test” node1!node2!joe
and node2 is your local host, you must receive a message similar to this:
From node1!node2!joe Wed Aug  6 09:48 MDT 2003
Received: by node2; Wed, 6 Aug 02 09:48:09 mdt
Return-Path: <node1!node2!joe>
Received: from node1.UUCP; Wed, 6 Aug 02 09:30:16
Received: by node1; Wed, 6 Aug 02 09:30:16 mdt
Received: from node2.UUCP; Wed, 6 Aug 02 09:26:18
Received: by node2; Wed, 6 Aug 02 09:26:18 mdt
Date: Wed, 6 Aug 02 09:26:18 mdt
From: Joe User <node1!node2!joe>
To: node1!node2!joe
Subject: UUCP Test

Wed Aug  6 09:26:15 MDT 2002

An entry in your /var/adm/syslog/mail.log file must have been logged for the UUCP mail transaction. See “Configuring and Reading the Sendmail Log” for more information.

NOTE: In this example, if you send a mail message to yourself and if the remote system is running Sendmail, ensure that the MeToo option is set in the configuration file on the remote system. The remote system’s configuration file must contain a line beginning with O MeToo. If the remote host’s configuration file does not contain such an entry, Sendmail on the remote host notices that the sender is the same as the recipient and removes your address from the recipients’ list.

Using SMTP Transport to Send Mail to a Remote User

If you are using the SMTP Transport, you can verify your Sendmail installation by sending a message to a remote user using a user @host address, where host is a system that provides an SMTP server (for example, the Sendmail daemon).

To verify both inbound and outbound SMTP connections, mail the message in a loop, using the syntax user %my_host @remote_host.
For example, if you try:

lx -s “Round Robin SMTP” joe%node2@node1
you must receive a message similar to the following:
From joe@node2 Wed Aug  6 14:22 MDT 2003
Received: from node1 by node2; Wed, 6 Aug 02 14:22:56  mdt
Return-Path: <joe@node2>
Received: from node2 by node1; Wed, 6 Aug 02 14:25:04  mdt
Received: by node2; Wed, 6 Aug 02 14:22:31 mdt
Date: Wed, 6 Aug 02 14:22:31 mdt
From: Joe User <joe@node2>
To: joe%node2@node1
Subject: Round Robin SMTP

Wed Aug  6 14:22:28 MDT 2002

An entry in your /var/adm/syslog/mail.log file must have been logged for the SMTP mail transaction. See “Configuring and Reading the Sendmail Log” for more information.

NOTE: In this example, if you send a mail message to yourself and if the remote system is running Sendmail, ensure that the MeToo option is set in the configuration file on the remote system. The remote system’s configuration file must contain a line beginning with O MeToo. If the remote host’s configuration file does not contain such an entry, Sendmail on the remote host notices that the sender is the same as the recipient and removes your address from the recipients’ list.
© 2006 Hewlett-Packard Development Company, L.P.