![配置 sendmail 以存档所有外发邮件的副本](https://linux22.com/image/795429/%E9%85%8D%E7%BD%AE%20sendmail%20%E4%BB%A5%E5%AD%98%E6%A1%A3%E6%89%80%E6%9C%89%E5%A4%96%E5%8F%91%E9%82%AE%E4%BB%B6%E7%9A%84%E5%89%AF%E6%9C%AC.png)
如何配置 sendmail 以保留我发送的任何邮件的副本。一个选项是自动将副本发送回我的邮箱。
答案1
1 创建文件${CFDIR}/mailer/copymail.m4:
PUSHDIVERT(-1)
ifdef(`COPYMAIL_MAILBOX',,
`define(`COPYMAIL_MAILBOX', `postmaster')')dnl
POPDIVERT
#########################################
### COPYMAIL Mailer specification ###
#########################################
VERSIONID(`$Id: cpsendmail.html,v 1.2 2002/06/14 18:39:10 freeman Exp $')dnl
LOCAL_CONFIG
D{COPYMAIL}COPYMAIL
C{CP}${COPYMAIL}
LOCAL_RULE_0
# Send all mail to copymail mailer
R$* < @ $+ . $~{CP} . > $#copymail $@ $2 . $3 . ${COPYMAIL} $: $1 @ $2 . $3 . ${COPYMAIL}
# if mail has been processed by copymail mailer, process it usual way...
R$* < @ $* . ${COPYMAIL} > $1 < @ $2 . >
# Send message to original recipient + additional mailbox: COPYMAIL_MAILBOX
Mcopymail, P=/usr/sbin/sendmail, F=fmSDFMu, S=0, R=0,
A=sendmail -N never COPYMAIL_MAILBOX.${COPYMAIL} $u
2 添加到 sendmail.mc 末尾
define(`COPYMAIL_MAILBOX',`user@domen')
MAILER(copymail)
3 编译并安装新的sendmail.mc
4 重新启动 sendmail
5 测试
答案2
检查语法如下
IE ”点击这里“
R$* < @ $+ . $~{CP} . >"**TAB HERE**"$#copymail $@ $2 . $3 . ${COPYMAIL} $: $1 @ $2 . $3 . ${COPYMAIL}
# if mail has been processed by copymail mailer, process it usual way...
R$* < @ $* . ${COPYMAIL} >"**TAB HERE**"$1 < @ $2 . >