How to Replace Sendmail with Postfix Under FreeBSD
This How-to applies to: FreeBSD 5.x, Postfix 2.x
You can find the Postfix web site at http://www.postfix.org/.
- Stop Sendmail prior to installing Postfix. The Postfix
installation will modify the startup/shutdown scripts, making it
more difficult to properly stop Sendmail if it is still running at
that point.
/etc/rc.d/sendmail stop
- Install Postfix from the ports tree and configure it to start at
boot with the following commands:
portinstall -m BATCH=yes mail/postfix ed a # # Execute the Postfix sendmail program, named /usr/local/sbin/sendmail # sendmail /usr/local/sbin/sendmail send-mail /usr/local/sbin/sendmail mailq /usr/local/sbin/sendmail newaliases /usr/local/sbin/sendmail . w /etc/mail/mailer.conf q ed /etc/rc.conf a sendmail_enable="YES" sendmail_flags="-bd" sendmail_pidfile="/var/spool/postfix/pid/master.pid" sendmail_procname="/usr/local/libexec/postfix/master" sendmail_outbound_enable="NO" sendmail_submit_enable="NO" sendmail_msp_queue_enable="NO" . wq
- Disable FreeBSD's default Sendmail-specific mail maintenance
routines with the following commands:
ed a daily_clean_hoststat_enable="NO" daily_status_mail_rejects_enable="NO" daily_status_include_submit_mailq="NO" daily_submit_queuerun="NO" . w /etc/periodic.conf q
- Reconfigure Postfix to listen only on the loopback interface,
mimicing sendmail's default listener configuration, with the
following command:
sed -i '' -e 's/^smtp *inet/localhost:smtp inet/' /usr/local/etc/postfix/master.cf
- Optional: In their default configurations, both
sendmail and Postfix will try to deliver messages directly to their
destinations. If desired, you can configure Postfix to relay mail
through a proxy with the
relayhostsetting. Reconfigure Postfix to relay to the mail exchangers of the computer's DNS domain (as listed in that domain's MX records) with the following commands:ed /usr/local/etc/postfix/main.cf a relayhost = $mydomain . wq
If you prefer to relay through a specific host, use these commands instead (replacingmail.example.comwith the host name or IP address of your relay):ed /usr/local/etc/postfix/main.cf a relayhost = [mail.example.com] . wq
- Start Postfix with the following command:
/etc/rc.d/sendmail start