SendMail as a secondary MX

As far as I can tell, setting up SendMail to act correctly as a secondary MX is a bit of a drag. SendMail seems to run into problems if it is a secondary MX, and it gets a message when all higher-priority MXes for the domain are down. Without special configuration, it will bounce the message with a "mail loops back to me (MX problem?)" error.

The very first steps to setting this up are:

Add MX records in DNS. For example   MX 0
                MX 10

MXes with the lowest numbers are given the highest priority. I'm assuming that you already have a primary setup, and that part won't be explained here.

Now, on the secondary (this assumes you have /etc/mail/access and /etc/mail/mailertable):

  1. Add a line containing RELAY to /etc/mail/access.
  2. Add a line containing to /etc/mail/mailertable (this is the bit that seems to commonly not be mentioned).
  3. Run make in /etc/mail. Check the timestamps of access.db and mailertable.db to be sure that they have just been regenerated. If they haven't, touch access mailertable and check your clock.

    If you don't have a MakeFile, run makemap hash access.db < access; makemap hash mailertable.db < mailertable.

  4. Restart sendmail(8), probably /etc/init.d/sendmail restart
  5. Try sending a test message from a local address through the secondary to

You should be all set. Try making the primary unreachable from the secondary, just to be sure, and repeat step 6. The easiest way to make it unreachable is to log into preferredmx and do route add dev lo. By doing this you are (temporarily) adding a bad route between the two boxes. If you don't understand the implications of that, you probably don't want to do it. Do not do that if you are presently logged into preferredmx from secondarymx, and that is the only way you can reach preferredmx. Be sure to route del dev lo after you are done testing.

make in /etc/mail doesn't build

You just updated your /etc/mail/, but when you run make, nothing happens. If you manually try to make using m4(1), you get an error along the lines of
<verbatim> m4: Cannot open /usr/share/sendmail-cf/m4/cf.m4: No such file or directory <verbatim>

If you run RedHat, this means you need to install the sendmail-cf Package.

Why there is a seperate package for people who want to actually configure SendMail, I don't know.

Part of UserSubmittedNotes