Skip to main content

AIX sendmail Basics


 Technote (FAQ)
 
Problem
AIX sendmail Basics
 
Solution

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 5L and sendmail levels 8.11.

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
The sendmail configuration file /etc/mail/sendmail.cf
    Local host definitions Dw, Dm, and Cw
    Configuring for relay DS
    Masquerading DM

How sendmail is started

sendmail is started on system boot in the /etc/rc.tcpip file. When started, it requires several options to run as a background process and to listen for incoming messages, as per the following:

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

To stop sendmail, enter the following command:

     stopsrc -s sendmail

The sendmail configuration file /etc/mail/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 hostname, domain name and host aliases. This is done in a two-step process.

  1. The output 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 hostname 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. Note that sendmail is expecting a domain name, so you may need to add an alias for your hostname which includes 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 hostname 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. Do not fix $j in the config file. Instead, this is fixed one of two ways.

Edit the /etc/hosts file and give the local system's hostname a domain name. For example, 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 bogus. This is considered to be the "null domain workaround."

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 is able to resolve internet names via DNS, and it also has connectivity to the internet to deliver the mail. Typically, the DS is a firewall, or a system that is trusted by the firewall.

The DS option 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 are therefore not resolvable on the internet (if your intranet <hostname> shows in the from: <hostname>.<domain name>). As a result, since your intranet <hostname> is not resolvable on the internet, reply messages would fail. By defining the DM variable, sendmail will use the <domain name> on the from: line of all outgoing messages, so that Internet users may reply to this address. The assumption is that the <domain name> you specify is resolvable via DNS on the internet.

By setting DM as follows, all outgoing mail will be from user@lab.net.


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

Ruleset S94 on AIX Version 5L, sendmail Version 8.11
Edit the Ruleset S94 to be the same as the example shown below:

###################################################################
###  Ruleset 94 -- convert envelope names to masqueraded form   ###
###################################################################
SMasqEnv=94
#R$* <@ *LOCAL* > $*   $: $1 <@ $j . > $2
R$+                     $@ $>MasqHdr $1

NOTE: The line that starts with R$* was commented out and line that starts with R$+ was added. For the new line to work correctly there must be tabs between the left part of the ruleset and the right part.

NOTE: By default, masquerading will not occur for the root user. Check the CE option in the sendmail.cf for more details.

 
 
Historical Number
isg1pTechnote0445
 
 

Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.
Document information
 AIX family
 Software version:
  5.1, 5.2, 5.3
 Operating system(s):
  AIX
 Reference #:
  T1000289
 Modified date:
 2006-03-30

Translate My Page