I need advice from a serious sendmail guru who knows about rules.
I am using sendmail 8.14.4 on Linux Slackware distro 13.37.0, kernel version 2.6.37.6. I am trying to set up sendmail to copy all non-local emails to be delivered to the smarthost to a specific mailbox for spam analysis.
Following the sparse, but workable instructions at:
http://serverfault.com/questions/229...tgoing-message
I created the following M4 file in /usr/share/sendmail/cf/mailer/copymail.cf
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
and added the following lines to my sendmail.mc file:
define(`COPYMAIL_MAILBOX',`user@domen')
MAILER(copymail)
This worked beautifully ... but for locally delivered mail only! I don't care about archiving local mail, I only want mail which is sent on to the SmartHost.
I don't really understand how to make rules in sendmail. I just monkey-typed the copymail.m4 file shown above. Is there anyone with some knowledge of sendmail rules who could give me instructions on how to modify the copymail.m4 rules to copy only mail sent to the smarthost?
Thanks - in need!