N.B. This post is as much an aide-memoire to myself as anything else. I found it difficult to find the right web search terms to use to learn how to configure sendmail, so this information was more or less hard-won by experience, hence I don’t want to forget it.

 

Basics

Sendmail’s configuration files live at /etc/mail. They are named sendmail.cf and submit.cf. They are not designed to be updated directly however – they are compiled by running the ‘human-readable’ versions (suffixed .mc instead of .cf) through a pre-processor, which is achieved by executing make whilst in the /etc/mail directory. This is where things get weird – sendmail.mc and submit.mc do not exist. Instead, a newly-installed jail will have the following files:

freebsd.mc

freebsd.cf (exact match for sendmail.cf)

freebsd.submit.mc

freebsd.submit.cf (exact match for submit.cf)

Making Configuration Changes

What changes you need to make are outside the scope of this blog, but the files to which changes should be applied are freebsd.mc and freebsd.submit.mc.

Applying Configuration Changes

Once those files are saved, execute make whilst /etc/mail is you current working directory. It is important to note that all ‘negative’ output, even warnings, is likely to cause the process to fail, so take heed of warnings and errors and work out how to fix them in the .mc files. Note also that the make process invokes sendmail using the previous set of configuration files, so your old sendmail.cf and submit.cf files must be in place before running make. The output of a successful make will be the same set of four files as listed in Basics above, except the file prefix will be your jail’s hostname instead of freebsd. The final step to apply this new configuration is to copy <hostname>.cf and <hostname>.submit.cf to sendmail.cf and submit.cf. I would recommend first saving the old files somewhere as backups, given that you always need to have a ‘known good’ set available in order to be able to make new configurations.