From c75629a55f1b357c4dbe4982d5adf548f30ab825 Mon Sep 17 00:00:00 2001 From: Tom Rhodes Date: Thu, 25 Apr 2002 22:34:48 +0000 Subject: [PATCH] Add information on changing the default MTA. PR: 37121 Submitted by: Andrew Boothman --- .../books/handbook/mail/chapter.sgml | 246 ++++++++++++++++-- 1 file changed, 231 insertions(+), 15 deletions(-) diff --git a/en_US.ISO8859-1/books/handbook/mail/chapter.sgml b/en_US.ISO8859-1/books/handbook/mail/chapter.sgml index 1e5e194d00..b521cb1980 100644 --- a/en_US.ISO8859-1/books/handbook/mail/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/mail/chapter.sgml @@ -49,6 +49,9 @@ How to block spammers from illegally using your mail server as a relay. + How to replace sendmail + as your system's default mailer. + How to troubleshoot common mail server problems. @@ -406,22 +409,7 @@ mail.example.com restarted for it to read the changes. - - <filename>/etc/mail/mailer.conf</filename> - The mailer.conf configuration file - holds a table containing the real mailer that is used for the - given action. Very old software programs would hard-code in the - name and path to the mailer, - /usr/sbin/sendmail, which meant they where - incompatible with other mailers such as postfix. Today, - /usr/sbin/sendmail is a wrapper that looks - at /etc/mail/mailer.conf and executes the - correct binary. When another mail transfer agent is installed - on the system, mailer.conf should be - updated to reflect the correct programs to execute. - - <filename>/etc/mail/sendmail.cf</filename> @@ -475,6 +463,234 @@ postmaster@example.com postmaster@noc.example.net + + + + + + Andrew + Boothman + Written by + + + + + Gregory + Neil Shapiro + Information taken from e-mails written by + + + + Changing your Mail Transfer Agent + + email + change mta + + + 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 simply 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. + + + Install a new MTA + + 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 won't 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. + + + + Disable <application>sendmail</application> + + The procedure used to start + sendmail changed significantly + between 4.5-RELEASE and 4.6-RELEASE. Therefore, the procedure + used to disable it is subtly different. + + + FreeBSD 4.5-STABLE before 2002/4/4 and earlier + (including 4.5-RELEASE and earlier) + + Enter: + + sendmail_enable="NO" + + into /etc/rc.conf. This will disable + sendmail's incoming mail service, + but if /etc/mail/mailer.conf (see below) + is not changed, sendmail will + still be used to send e-mail. + + + + FreeBSD 4.5-STABLE after 2002/4/4 + (including 4.6-RELEASE and later) + + In order to completely disable + sendmail you must use + + sendmail_enable="NONE" + + in /etc/rc.conf. + + + If you disable sendmail's + outgoing mail service in this way, it is important that you + replace it with a fully working alternative mail delivery + system. If you choose not to, system functions such as + &man.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 and send + e-mail after you have disabled it, the mail may transparently + queue forever. + + + If you only want to disable + sendmail's incoming mail service, + you should set + + sendmail_enable="NO" + + in /etc/rc.conf. More information on + sendmail's startup options is + available from the &man.rc.sendmail.8; manual page. + + + + Running your new MTA on boot + + You may have a choice of two methods for running your + new MTA on boot, again depending on what version of FreeBSD + you are running. + + + FreeBSD 4.5-STABLE before 2002/4/11 + (including 4.5-RELEASE and earlier) + + Add a script to + /usr/local/etc/rc.d/ that + ends in .sh and is executable by + root. The script should also accept the parameters 'start' + or 'stop'. So that you could, for example, execute + /usr/local/etc/rc.d/supermailer.sh start + or /usr/local/etc/rc.d/supermailer.sh stop. + The system will call your script using 'start' when the it + boots and using 'stop' when the it shuts down. + + + + + FreeBSD 4.5-STABLE after 2002/4/11 + (including 4.6-RELEASE and later) + + With later versions of FreeBSD, you can use the + above method or you can also set + + mta_start_script="filename" + + in /etc/rc.conf, where + filename is the name of some + script that you want executed on boot to start your + MTA. + + + + + + Replacing <application>sendmail</application> as + the system's default mailer + + Sendmail is so ubiquitous + as standard software on Unix systems, that some software + just presumes that it is already installed and configured. + For this reason, many alternative MTA's provide utilities + that implement exactly the same command-line interface + that sendmail provides. + + 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 &man.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: + +sendmail /usr/libexec/sendmail/sendmail +send-mail /usr/libexec/sendmail/sendmail +mailq /usr/libexec/sendmail/sendmail +newaliases /usr/libexec/sendmail/sendmail +hoststat /usr/libexec/sendmail/sendmail +purgestat /usr/libexec/sendmail/sendmail + + This means that when any of these common commands + are run, such as /usr/bin/sendmail + the program that is actually sitting in that location + 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 system utilities + are run. + + Therefore if you wanted + /usr/local/supermailer/bin/sendmail-compat + to be run instead of sendmail, you would change + /etc/mail/mailer.conf to read: + +sendmail /usr/local/supermailer/bin/sendmail-compat +send-mail /usr/local/supermailer/bin/sendmail-compat +mailq /usr/local/supermailer/bin/mailq-compat +newaliases /usr/local/supermailer/bin/newaliases-compat +hoststat /usr/local/supermailer/bin/hoststat-compat +purgestat /usr/local/supermailer/bin/purgestat-compat + + + + + Finishing + + Once you have everything configured how 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 you should reboot your machine. Rebooting will also + give you the opportunity to ensure that you have correctly + configured your machine to start your new MTA on boot. + + + + Troubleshooting