AIX sendmail Basics

AIX sendmail Basics


Contents

About this document
How sendmail is started
The sendmail configuration file /etc/sendmail.cf
    Local host definitions Dw, Dm, and Cw
    Configuring for relay DS
    Masquerading DM

About this document

sendmail is a program for sending and receiving email messages. To receive an email message, sendmail must run in the background listening on port 25, the smtp port, for incoming mail messages. When email arrives on port 25, sendmail evaluates the address of the message and will deliver it to a local user, forward it to the host that the mail is addressed to , or in the case of an error, bounce the mail back to the originator. There are other options sendmail may take but these are the most common functions and the only ones discussed in this document.

This document applies to AIX Versions 4.2 and 4.3 and sendmail levels 8.7, 8.8 and 8.9.

For the sending of email messages, sendmail is not directly accessed by the user. sendmail will be called by other programs to deliver the mail. The mail command is a common command line tool for creating email, as are elm and pine.


How sendmail is started

sendmail is started on system boot in the /etc/rc.tcpip file. It requires several options to run as a background process and listen for incoming messages. By default, sendmail is started with a command equivalent to the following:

     startsrc -s sendmail -a "-bd -q30m"

To stop sendmail, enter the following command:

     stopsrc -s sendmail

The sendmail configuration file /etc/sendmail.cf

The sendmail.cf contains a great number of variables and options, as well as what are known as rewrite rules. This document will cover the most used variables.

NOTE: IBM Support does not support the altering of the rewrite rules in the sendmail.cf, other than removing comments to enable functions. For that, you may consider an IBM Consult Line contract.

Local host definitions Dw, Dm, and Cw

sendmail will attempt to define the variables Dw, Dm and Cw automatically in memory by default. Dw, Dm and Cw represent, respectively, your host name, domain name and host aliases. This is done in a two-step process.

  1. The product of the hostname command is used to define the Dw variable.
  2. Then a gethostbyname system call is used by sendmail to find a domain name and any aliases, which are used to define the Dm and Cw variables.
  3. Most problems with sending and receiving mail occur when these variables are defined incorrectly. These problems can be caused by incomplete entries in /etc/hosts, or incorrect information in the DNS server.

Test it

Use the hostname command to verify the local system's host name definition and correct it if necessary with smitty hostname. Run host <hostname> to see the information that sendmail is using to define Dm and Cw. Remember, sendmail is expecting a domain name.

Also, a sendmail debug option may be used to display these definitions. Enter the following command to view the System Identity section:

     sendmail -d0.4

Fix it

sendmail is built to work with DNS for resolving host names. If a system is not configured for DNS, that is, the /etc/resolv.conf file does not exist, then sendmail must be told not to use the DNS by creating the file /etc/netsvc.conf with an entry as follows:

     hosts=local

If NIS is used, then the entry should read either hosts=local,nis or hosts=nis,local, your choice.

Because sendmail is built to use a DNS, sendmail also expects the host name to have a domain name. If a host running sendmail does not have a domain name, sendmail will loop because it cannot define the Dm variable. The typical error message is fix $j in config file, but this is misleading so don't fix $j in the config file. This is fixed one of two ways.

Edit the /etc/hosts file and give the local systems host name a domain name 1.1.1.1 bogus will become 1.1.1.1 bogus.lab.net bogus (the short name was moved to the alias position) or 1.1.1.1 bogus. This is considered incorrect but will work as long as the DS variable is not defined. The DS variable is covered in the next section.

Configuring for relay DS

When a workstation that is behind a firewall needs to send and receive Internet mail, the DS and DM variables are used. The comments for the DS entry describe the server defined there as a Smart Relay. A Smart Relay is a system that has access to a working DNS, and has Internet connectivity so that it is able to make a network connection and deliver the mail. Typically, the DS is a firewall, or a system that is trusted by the firewall.

The DS options would be defined, as follows:

DSsmtp:firewall.lab.net
                 or
DSsmtp:[1.1.1.99]   (If an IP address is used, it must be in square brackets.)

Masquerading DM

Typically, hosts on an intranet are behind a firewall and hidden from internet users. Incoming mail is addressed to users at a domain name, for example, joe@hotmail.com. By defining the DM variable, sendmail will use the domain on the from: line of all outgoing messages so that Internet users may reply to this address.

By setting DM as follows, all outgoing mail will be from user@lab.net and joe@hotmail.com will be able to reply:

     DMlab.net

If an error message such as, sender domain must exist is received on Internet messages, then ruleset S94 must be uncommented to enable envelope masquerading. Search the sendmail.cf for S94 and remove the pound sign (#).

Example of ruleset S94 on AIX Version 4.2.1, sendmail Version 8.7

 ################################################################### 
 ###  Ruleset 94 -- convert envelope names to masqueraded form   ### 
 ################################################################### 

 S94 
 #R$+                    $@ $>93 $1

Example of ruleset S94 from AIX Version 4.3.3, sendmail Version 8.8.8

 ################################################################### 
 ###  Ruleset 94 -- convert envelope names to masqueraded form   ### 
 ################################################################### 

 S94 
 #R$+                    $@ $>93 $1 
 R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2

Uncomment the first line and comment out the second.

NOTE: Masquerading will not occur for the root by default. Check the CE option in the sendmail.cf for more details.




[ Doc Ref: 95252877421836     Publish Date: Jul. 24, 2000     4FAX Ref: 8598 ]