How to build sendmail on AIX

 

This guide is for sendmail clients that will never receive mail directly and who send (relay) their mail through a mail relay server.

We will create a macro configuration file called null.mc and put the necessary macro values in it to allow the m4 program to read and process its input. The m4 program gathers the definitions of these macros, and then replaces these macros with their values and outputs the result to a configuration file called sendmail.cf

There is a sample macro file located in /usr/samples/tcpip/sendmail/cf called aixsample.mc however we will create our own called null.mc in the same directory.

Create a null.mc file containing the following lines.

include(`/usr/samples/tcpip/sendmail/m4/cf.m4')
OSTYPE(`aixsample')dnl
DOMAIN(`generic')dnl
FEATURE(`nullclient',`mail-relay')dnl
undefine(`ALIAS_FILE')dnl

The OSTYPE option specifies the operating system sendmail will be running on and corresponds to the name of a file in /usr/samples/tcpip/sendmail/ostype

If you do not have the file aixsample.m4 within this directory create a file with this name in /usr/samples/tcpip/sendmail/ostype containing the following lines.

divert(0)
VERSIONID(`$Id: v 8.11 1999/04/12 17:34:37 ca Exp $')
ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/bellmail)')dnl
ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', mail -F $g $u)')dnl
ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `mn9')')dnl
define(`confTIME_ZONE', `USE_TZ')dnl
define(`UUCP_RELAY', `relayhostname')dnl

The DOMAIN option specifies a particular domain in use in your environment. If you do not have a domain configured use generic.

The FEATURE option sets the client computer to never receive mail directly, to relay all mail through a Central Mail Hub (relay) rather then sending it directly. This feature creates a stripped down configuration file containing nothing but support for forwarding all mail to a mail relay server via a local SMTP based network. The argument `relayhostname' included in this feature is the canonical name of the mail relay server and should be changed to the name of your mail relay server.

The undefine option prevents the nullclient version of sendmail from trying to access /etc/mail/aliases and /etc/mail/aliases.db files. Aliases files are required only on the mail relay server for all server and client aliases on the network.

Now that we have created a macro configuration file null.mc we can build the sendmail configuration file sendmail.cf using the following commands.

cd /usr/samples/tcpip/sendmail/m4

m4 cf.m4 ../cf/null.mc > sendmail.cf

cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.old

cp sendmail.cf /etc/mail/sendmail.cf

Since no mail will now be delivered to the local computer there will be no incoming mail connections and therefore there is no need to run a sendmail daemon on the local computer.

To stop the sendmail daemon from running type.

stopsrc -s sendmail

To disable the sendmail daemon from running on system startup comment out the sendmail start lines from the relevant system file, probably /etc/rc.tcpip as shown below.

#qpi=30m  # 30 minute interval
#start /usr/lib/sendmail "$src_running" "-bd -q${qpi}"