Reputation: 21
i added the following line to the postfix master.cf
filter unix - n n - 10 pipe flags=Rq user=filter null_sender= argv=/tmp/filter.sh -f ${sender} -- ${recipient}
my test script filter.sh code looks like this:
#!/bin/sh
SENDMAIL="/usr/sbin/sendmail -G -i" # NEVER NEVER NEVER use "-t" here.
export HOME=/home/filter
SENDER="$2" #sender
shift
shift
shift
EMPFAENGER="$@" #empfaenger
#echo "SENDER=$SENDER" >> /tmp/logging.log
#echo "EMPFAE=$EMPFAENGER" >> /tmp/logging.log
touch itworked
cat | $SENDMAIL -f $SENDER -- $EMPFAENGER
When i send an email it will be delivered, but i its not piped through the script.
Does anybody know what i configured wrong?
PS:
Greetings Chris
Upvotes: 1
Views: 1185
Reputation: 141
You're missing a step. In your configuration file master.cf
, the first service is:
smtp inet n - - - - smtpd
you have to tell postfix
you want to use your filter
, so:
smtp inet n - - - - smtpd -o content_filter=filter
Do not forget to execute postfix reload
after editing this file.
Upvotes: 1