FreeBSD - 如何更改 sendmail 样式

Sendmail 是 FreeBSD 中的默认 MTA。
FreeBSD 有自己的方式来管理 sendmail 的配置文件。
不应更改 sendmail.mc,而应更改 $(hostname).mc。
同样对于 submit.mc,更改应该是 $(hostname).submit.mc。

设置

上一步只在第一次更改配置文件之前需要。
现在,每次对 Sendmail 配置文件进行更改时,请执行以下操作:

  • 编辑 hostname.mc 或者 hostname.submit.mc
  • 生成必要的 .cf 文件:
make install
  • 重新启动 Sendmail 守护进程:
make restart

事实上,还有更多的选项来管理 Sendmail :

# The user-driven targets are:
#
# all - Build cf, maps and aliases
# cf - Build the .cf file from .mc file
# maps - Build the feature maps
# aliases - Build the sendmail aliases
# install - Install the .cf file as /etc/mail/sendmail.cf
#
# For acting on both the MTA daemon and MSP queue running daemon:
# start - Start both the sendmail MTA daemon and MSP queue running
# daemon with the flags defined in /etc/defaults/rc.conf or
# /etc/rc.conf
# stop - Stop both the sendmail MTA daemon and MSP queue running
# daemon
# restart - Restart both the sendmail MTA daemon and MSP queue running
# daemon
#
# For acting on just the MTA daemon:
# start-mta - Start the sendmail MTA daemon with the flags defined in
# /etc/defaults/rc.conf or /etc/rc.conf
# stop-mta - Stop the sendmail MTA daemon
# restart-mta - Restart the sendmail MTA daemon
#
# For acting on just the MSP queue running daemon:
# start-mspq - Start the sendmail MSP queue running daemon with the
# flags defined in /etc/defaults/rc.conf or /etc/rc.conf
# stop-mspq - Stop the sendmail MSP queue running daemon
# restart-mspq - Restart the sendmail MSP queue running daemon
#
# Calling `make' will generate the updated versions when either the
# aliases or one of the map files were changed.
#
# A `make install` is only necessary after modifying the .mc file. In
# this case one would normally also call `make restart' to allow the
# running sendmail to pick up the changes as well.

这些选项来自 /etc/mail/Makefile。
可以看一看。

准备

在第一次更改 Sendmail 之前,请在 /etc/mail 中准备配置文件:

cd /etc/mail
make

这会将 freebsd.mc 复制到 $(hostname).mc 并将 freebsd.submit.mc 复制到 $(hostname).submit.mc 然后生成 .cf 文件。

日期:2020-06-02 22:18:24 来源:oir作者:oir