r***@gmail.com
2016-03-31 10:13:28 UTC
Hi
I am trying to make a content filter via pcre:header_checks but reinjecting the mail with sendmail command reexecutes the filter again and again and I have a bounce. Has anyone an idea why Postfix is behaving like this?
master.cf:
smtp inet n - n - - smtpd
-o content_filter=spamassassin
# Header check filter To:
header_checks_to unix - n n - - pipe
flags=qR user=filter argv=/etc/postfix/header_checks_to.sh ${sender} ${recipient}
# Spamassassin
spamassassin unix - n n - - pipe
user=debian-spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
main.cf:
header_checks = pcre:/etc/postfix/header_checks
header_checks:
# Header Check To Filter
/^To:.*@runlevel\.ch\b/ FILTER header_checks_to:dummy
header_checks_to.sh:
#!/bin/bash
SENDMAIL="/usr/sbin/sendmail -i -G"
TEMPFILE="/tmp/in.$$"
trap "rm -rf $TEMPFILE" 0 1 2 3 15
cat >$TEMPFILE
logger -p mail.info -t filter "$0 $@ executed"
$SENDMAIL "$@" <$TEMPFILE
exit $?
I am trying to make a content filter via pcre:header_checks but reinjecting the mail with sendmail command reexecutes the filter again and again and I have a bounce. Has anyone an idea why Postfix is behaving like this?
master.cf:
smtp inet n - n - - smtpd
-o content_filter=spamassassin
# Header check filter To:
header_checks_to unix - n n - - pipe
flags=qR user=filter argv=/etc/postfix/header_checks_to.sh ${sender} ${recipient}
# Spamassassin
spamassassin unix - n n - - pipe
user=debian-spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
main.cf:
header_checks = pcre:/etc/postfix/header_checks
header_checks:
# Header Check To Filter
/^To:.*@runlevel\.ch\b/ FILTER header_checks_to:dummy
header_checks_to.sh:
#!/bin/bash
SENDMAIL="/usr/sbin/sendmail -i -G"
TEMPFILE="/tmp/in.$$"
trap "rm -rf $TEMPFILE" 0 1 2 3 15
cat >$TEMPFILE
logger -p mail.info -t filter "$0 $@ executed"
$SENDMAIL "$@" <$TEMPFILE
exit $?