When they apply, you should use the instructions that ship with the vanilla sendmail.org distribution. These FAQs address some of the areas where FreeBSD's implementation diverges from the distribution.
Make modifications to the sendmail configuration file (sendmail.cf) by first editing a macro configuration (mc) file. Then generate a new sendmail.cf from the macro configuration file.
# cd /etc/mail
If you aren't sure whether you have a working mc file, issue the command hostname to find your server's name. Then type ls to list the files in the /etc/mail directory. If you see a file with a name that begins with your host name and ends with ".mc", then you already have a working mc file, and you can omit this step. This initial make command copies the macro configuration file that is shipped with FreeBSD (named freebsd.mc) to the working mc file. (It probably isn't a good idea to modify freebsd.mc directly.)
This is the step where you add the FEATURE's, definitions, etc., that appear in the sendmail documentation. Sendmail recommends the following order for mc lines:
- option definitions. (Most--but not all--of these start with "define". Two examples:)
INPUT_MAIL_FILTER(`clmilter',`S=local:/var/run/clamav/clmilter.sock, F=, T=S:4m;R:4m')
- macro definitions
- ruleset definitions (e.g. LOCAL_RULE_0, Local_check_mail ...)
If it isn't immediately obvious where to insert an additional line--after carefully reading the above list--try inserting your addition somewhere after the DOMAIN line (or after OSTYPE if your mc file doesn't have a DOMAIN line) and before the MAILER lines.
Some FEATUREs are "order-dependent"--they must appear (in the mc file) before or after others. If unsure, consult the cf/README.
# make # make install
The first make command creates a file named <hostname>.cf from the <hostname>.mc file. The second make command copies <hostname>.cf to sendmail.cf
# make restart
The make restart command restarts both sendmail daemons (including the submission daemon--which reads the submit.cf rather than sendmail.cf).
After editing the text file(s) from the which the map files are created,
# cd /etc/mail # make
It is not necessary to restart sendmail after regenerating the "db" files--sendmail detects that they have changed and re-reads them. (For the truly paranoid, however, it probably doesn't hurt anything ... :-)
# cd /etc/mail # make start
# cd /etc/mail # make stop
# cd /etc/mail # make restart
Try adding the following lines to /etc/rc.conf:
If you see that sendmail_enable and sendmail_submit_enable are already set in /etc/rc.conf--to values other than "YES"--it might be sufficient to just comment out the lines you find there. For more possibilities, search for "sendmail" in the file /etc/defaults/rc.conf. "NO" and "NONE" are other possible values for sendmail_enable. If you don't want any sendmail processes started, use "NONE". ("NO" prevents the inbound [MTA] daemon from running, but won't block the submission daemon from running.)
First, install procmail.
Hint: Use the FreeBSD ports tree: cd /usr/ports/mail/procmail; make; make install
Insert the following line in your sendmail macro configuration (mc) file:
The line must appear earlier in the file than the MAILER(local) directive!Then regenerate sendmail.cf from the mc file and restart sendmail.
Weldon Whipple <email@example.com>