Replacing the default Sendmail install on FreeBSD with Exim is very easy using the ports system.

Exim can be built with my optional extras, defined in the environment during build time, if you set these once using penv you won't need to worry about them again. The table below lists some of the most used ones.

WITH_SA_EXIM

SA-Exim for SpamAssassin built into Exim ACLs

WITH_CONTENT_SCAN

Enable content scan in the data ACL

WITH_MYSQL

Enable MySQL Queries

WITH_PGSQL

Enable Postgres Queries

WITHOUT_IPV6

Turn off IPv6

WITH_OPENLDAP

OpenLDAP Support

WITHOUT_PERL

Disable the embedded Perl interpreter

WITH_SPF

Enable SPF checking

WITH_SRS

Enable SRS

# cd /usr/ports/mail/exim
# penv -c mkdir
# penv -S WITHOUT_IPV6=1
# penv -S WITHOUT_PERL=1

The above lines will store my exim preferences outside of the ports tree using penv, once that is done portinstall will set the environment variables before compiling.

# portinstall exim

Once exim is built and installed there are a few manual configurations that needs to be done, first you need to configure the sendmail wrapper to call exim instead of sendmail, edit /etc/mail/mailer.conf to look as below.

sendmail        /usr/local/sbin/exim
send-mail       /usr/local/sbin/exim
mailq           /usr/local/sbin/exim
newaliases      /usr/local/sbin/exim
hoststat        /usr/local/sbin/exim
purgestat       /usr/local/sbin/exim

The daily scripts will call sendmail with a few times, this needs to be disabled in /etc/periodic.conf

daily_clean_hoststat_enable="NO"
daily_status_include_submit_mailq="NO"

Exim log files will need to be rotated, add the following to /etc/newsyslog.conf

/var/log/exim/mainlog   mailnull:mail 640 7 * @T00 ZN
/var/log/exim/rejectlog mailnull:mail 640 7 * @T00 ZN

By default exim will listen on all interfaces and IP addresses bound on the machine, if this machine is a host with jails on it you need to restrict it to the host IP address only, edit /usr/local/etc/exim/configure and add the following, replacing aaa.bbb.ccc.ddd with your IP address:

local_interfaces = aaa.bbb.ccc.ddd

To ensure sendmail does not start up place the following in /etc/rc.conf:

sendmail_enable="NONE"

Starting exim at boot time requires settings to be added to /etc/rc.conf, if you want to run a daemon listening on port 25 only add the following:

exim_enable="YES"

If instead you only want to be able to send mails, like the daily ones from cron, you still need to start exim but only in queue runner mode, add the following to /etc/rc.conf

exim_enable="YES"
exim_flags="-q30m"

Exim will by default refuse to deliver mail as the root user, which means mail to the root user will end up not being delivered, you have to set a alias entry to point mail at a real user, edit /etc/aliases:

root:   me@my.domain

Finally you can manually start exim, on the next boot it will start on it's own:

/usr/local/etc/rc.d/exim.sh start

Next Steps

With the basic install you will probably want to investigate setting up virtual users and some other features, I've written general guidelines for doing a few things in Exim:

Vacation Messages

Setting up vacation messages for users

Archiving Mail

Complying to corporate policies by saving all incoming and outgoing mails

Other interesting tutorials and links about Exim configurations:

Courier Authd

Using the Courier Authentication Daemon for SMTP Auth in Exim

Changelog

26/03/2005

Add some next step links

05/12/2005

Add rc.conf commands to stop sendmail

28/11/2005

Change link to penv wiki page

26/11/2005

Initial version

FreeBSD/EximBasicInstall (last edited 2006-03-26 11:05:58 by nat)