sendmail

This is the standard MTA under FreeBSD and its package name is mini_sendmail. New setups and jails come with sendmail pre installed. It might not be interesting to use sendmail as a public mail transport agent, but if you want to avoid to configure another client every time these configurations might come handy. The main configuration path is

/etc/mail/

The easiest way to configure sendmail under FreeBSD is by using the Makefile, which can be found under /etc/mail/. After having created a new jail it can be used by changing to that folder and executing make (without arguments). This first step will create files called $HOSTNAME.mc and $HOSTNAME.submit.mc out of the freebsd.mc and freebsd.submit.mc, where it is discouraged to edit the latter, because they may get replaced with the next update. So it is advisable to edit the $HOSTNAME*-files instead. To make sendmail redirect mails to another jail one needs this configuration:

where jail.mail stands for the mail receiving jail and can be assigned to an IP-address using the /etc/hosts-file. This makes the sender address being root@jail.mail, which may be misleading, but simplifies things a lot. To make mails from different jails distinguishable by the senders address, I am using chpass in order to change the senders default Charlie Root full user name to something more meaningful. Finally the setup can be applied with

make all install restart

It should now be possible to send a test mail from within that jail like so:

echo content of testmail | mail -vvv -s mysubject root

caveats

It has proven to be good practice to keep an eye on /var/log/maillog while testing. There might appear an error hash map "generics": unsafe map file /etc/mail/genericstable.db: Permission denied and if that happens it probably means, that sendmail cannot read it. The reason is, that the Makefile sets the files permissions to 640=rwxr----, but by default sendmail seems to get executed as user smmsp. A chgrp -R smmsp /etc/mail/ is my current fix for that.

Make use of another smtp server for delivery

I do not exactly know why, because this configuration file format really sucks, but it works.
Thanks to Andrew!

I recently found out, that sendmail.mc is based on the traditional m4 language, which also gets used for gEDA footprints, which I have already been in contact with. Shame on me.

further reading and sources
http://confighell.com/Sendmail

Command cheat sheet

max,