*****************************************************
Disclaimer:
The author of this post takes absolutely NO responsbility for any risks and voliations involving in anyway using this post. Be warned that eavesdropping emails is a serious crime.
Please keep above disclaimer intact when posting it in other forums. Thank you!
*****************************************************
Making an automatic copy of all inbound emails
*Create /etc/procmailrc PMDIR=/etc/procmail
LOGFILE=/var/log/pmlog
VERBOSE=yes # Set to yes when debugging; default is no
INCLUDERC=$PMDIR/rc.localcopy
*Create directory (files) and change permission (presume sendmail is running as root)
chmod 400 /etc/procmailrc
mkdir /etc/procmail
chmod 700 /etc/procmail
chmod 600 /etc/procmail/*
touch /var/log/pmlog
chmod 600 /var/log/pmlog
*Create /etc/procmail/rc.localcopy as follow:
:0c
! postmaster@mydomain.com # each messages will be forwarded to postmaster
Making an automatic copy of all outbound emails (tested in Redhat 8.0)
*Create /usr/share/sendmail-cf/cf/sendmail.mc (add the following line).
LOCAL_CONFIG
CP PROCMAIL
LOCAL_RULE_0
R$*<TAB>$: <> $1
R<> $+ < @ $+ . PROCMAIL . ><TAB>$: $>canonify $1 @ $2
R<> $+ < @ $+ . ><TAB>$: <> $1 < @ $2 >
R<> $+ < @ $+ > $#procmail $@ /etc/procmail/procsh<TAB>$: $1 < @ $2 . PROCMAIL . >
R<> $*<TAB>$: $1
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
*Replacing all <TAB> with real TAB and ./Build sendmail.cf.
*cp /usr/share/sendmail-cf/cf/sendmail.cf /etc/mail/sendmail.cf
*/etc/init.d/sendmail restart
* Create /etc/procmail/procsh as in sendmail.cf as:
PMDIR=/etc/procmail
LOGFILE=/var/log/pmlog
VERBOSE=yes
:0
* !^To:.*@yourdomain.com # for any emails sending out (not local domain)
{
:0c:
/var/mail/outbound # make a copy
}
:0
! -f "$@" # send message back to sendmail for handling
*chmod 400 /etc/procmail/procsh
* Make sure procsh is different from /etc/procmailrc because /etc/procmailrc is system level rc file for procmail. It could be used for CC inbound emails. Don't mix them together.
NOTES: By setting sendmail to use procmail as LDA (local delivery agent) in order to make a copy of all outbound emails, this sendmail server lose the ability to receive inbound emails. So far, I have not figured out how to solve this issue in sendmail. If you have any idea, please post it to this forum.
A work around is seperating inbound & outbound email servers, such as setting up an outbound email gateway (which is not uncommon), and using the standard sendmail configuration for inbound emails. Another option is using 2 sendmail binaries in this server, one for outbound and another for inbound, but it needs to be tested.
vincentzpf 回复于:2003-08-23 08:44:06 |
谢谢!!我来试一下!!! |
ilyxx 回复于:2003-09-02 12:01:46 |
能不能详细解释一下。谢谢! |
yuantong 回复于:2003-09-02 18:23:36 |
有没有关于qmail 的发进和发出邮件的备份方案? |
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/
领测软件测试网最新更新
关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073