Q:  How do I cause mail to be automatically forwarded to destinations outside our local network through some outside service?

A:  You'll need to make some minor changes to your mailhost's sendmail.cf file.  The sendmail configuration file, /etc/sendmail/sendmail.cf is either a link to sendmail.mailhost.cf or is some variant of the mailhost configuration.  You edit this file on your mailhostÐthe machine which is responsible for forwarding mail.

Look for the following lines near the top of the file (in the default sendmail.mailhost.cf, they start at line 30):

# If you want to use a relay mailer, examine ruleset 0.  There are some
# rules that need to be uncommented
DMuucp

# major relay host: use the $M mailer to send mail to other domains
# To have mail automatically forwarded to other domains, you should
# replace this with the name of your major relay host.
DR mail-relay
CR mail-relay

The line

DMuucp

tells sendmail that mail destined for a machine off the local network should be forwarded using the ªuucpº mailer Ð i.e., using the UNIX UUCP facility.  The lines 

DR mail-relay
CR mail-relay

indicate that the machine called mail-relay is the forwarding host.  Change these three lines to reflect your actual situation.  Typically, uucp is the appropriate mailer if you're not on the Internet.  Either replace mail-relay with the name of your UUCP partner, or ensure that mail-relay is a host alias of that partner.  (Note that if you make mail-relay be an alias for that partner and you're using UUCP as the relay mail mechanism, you have to modify the UUCP configuration files to reflect this alias.)

If you look at the comments which begin the excerpt included above, you see a note regarding uncommenting some lines in ªruleset 0.º  Look for the following lines in sendmail.cf (at line 323 in the default sendmail.mailhost.cf):

# If you want to pass all other explicit domain names up the ladder
# to our forwarder then uncomment the following line.
#R$*<@$*.$+>$*	$#$M    $@$R $:$1<@$2.$3>$4	user@any.domain
# and comment out this one.
R$*<@$+.$->$*	$#ddn $@ $2.$3 $:$1<@$2.$3>$4	user@any.domain

These lines describe how to forward non-local mail.  In the default file for a mailhost, such mail is forwarded using the ddn mailer (i.e., over the Internet).  We want to change that, to use the mail specified above, in the DM line.  To do this, uncomment the third line and comment out the fifth line:

# If you want to pass all other explicit domain names up the ladder
# to our forwarder then uncomment the following line.
R$*<@$*.$+>$*	$#$M    $@$R $:$1<@$2.$3>$4	user@any.domain
# and comment out this one.
#R$*<@$+.$->$*	$#ddn $@ $2.$3 $:$1<@$2.$3>$4	user@any.domain

WARNING: Be very careful when you modify a sendmail configuration file.  As you might notice, the syntax is arcane and cryptic, and the ªrewriting rulesº in the configuration file are intricate.

QA600

Valid for 1.0, 2.0 ,3.0, 3.1