As already mentioned, FreeBSD comes with sendmail already installed as your MTA (Mail Transfer Agent). Therefore by default it is in charge of your outgoing and incoming mail.
However, for a variety of reasons, some system administrators want to change their system's MTA. These reasons range from merely wanting to try out another MTA to needing a specific feature or package which relies on another mailer. Fortunately, whatever the reason, FreeBSD makes it easy to make the change.
You have a wide choice of MTAs available. A good starting point is the FreeBSD Ports Collection where you will be able to find many. Of course you are free to use any MTA you want from any location, as long as you can make it run under FreeBSD.
Start by installing your new MTA. Once it is installed
it gives you a chance to decide if it really fulfills your
needs, and also gives you the opportunity to configure your
new software before getting it to take over from
sendmail. When doing this, you
should be sure that installing the new software will not
attempt to overwrite system binaries such as
/usr/bin/sendmail. Otherwise, your new
mail software has essentially been put into service before
you have configured it.
Please refer to your chosen MTA's documentation for information on how to configure the software you have chosen.
If you disable sendmail's outgoing mail service, it is important that you replace it with an alternative mail delivery system. If you choose not to, system functions such as periodic(8) will be unable to deliver their results by e-mail as they would normally expect to. Many parts of your system may expect to have a functional sendmail-compatible system. If applications continue to use sendmail's binaries to try to send e-mail after you have disabled them, mail could go into an inactive sendmail queue, and never be delivered.
In order to completely disable sendmail, including the outgoing mail service, you must use
in /etc/rc.conf.
If you only want to disable sendmail's incoming mail service, you should set
in /etc/rc.conf. More information
on sendmail's startup options
is available from the rc.sendmail(8) manual
page.
The new MTA can be started during boot by adding a
configuration line to /etc/rc.conf
like the following example for postfix:
# echo
'postfix_enable=“YES”'
>> /etc/rc.confThe MTA will now be automatically started during boot.
The program sendmail is so ubiquitous as standard software on UNIX® systems that some software just assumes it is already installed and configured. For this reason, many alternative MTA's provide their own compatible implementations of the sendmail command-line interface; this facilitates using them as “drop-in” replacements for sendmail.
Therefore, if you are using an alternative mailer,
you will need to make sure that software trying to execute
standard sendmail binaries such as
/usr/bin/sendmail actually executes
your chosen mailer instead. Fortunately, FreeBSD provides
a system called mailwrapper(8) that does this job for
you.
When sendmail is operating
as installed, you will find something like the following
in /etc/mail/mailer.conf:
This means that when any of these common commands
(such as sendmail itself) are run,
the system actually invokes a copy of mailwrapper named
sendmail, which checks
mailer.conf and executes
/usr/libexec/sendmail/sendmail
instead. This system makes it easy to change what binaries
are actually executed when these default
sendmail functions are invoked.
Therefore if you wanted
/usr/local/supermailer/bin/sendmail-compat
to be run instead of sendmail, you
could change /etc/mail/mailer.conf to
read:
Once you have everything configured the way you want it, you should either kill the sendmail processes that you no longer need and start the processes belonging to your new software, or simply reboot. Rebooting will also give you the opportunity to ensure that you have correctly configured your system to start your new MTA automatically on boot.
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/
For questions about FreeBSD, read the
documentation before
contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.