Greetings,

I'm having troubles setting up the postfix after queue content filter.
http://www.postfix.org/FILTER_README.html

In a nutshell, the filter works correctly, however the sendmail
command re-inserts the mail into the queue, and it hits the content
filter again.
(which in turn re-inserts it into the queue, etc etc etc).

I think I'm missing something very simple..  Some option.
I've tried various stabs in the dark, but (obviously since I am
writing) none have worked.

The postfix version says:
Mar 18 22:11:59 localhost postfix/master[19163]: daemon started --
version 2.9.6, configuration /etc/postfix

--------- main.cf snippet -------

content_filter = sent_to_store
receive_override_options = no_address_mappings


-------- master.cf snippet -----------

sent_to_store unix  -       n       n       -       10      pipe
  directory=/home/mv user=mv flags=Rq null_sender=
argv=/home/mv/deploy/postfix/SentToStore ${sender} -- ${recipient}


------- SentToStore --------

#!/bin/sh

# Simple shell-based filter. It is meant to be invoked as follows:
#       /path/to/script -f sender recipients...

# Localize these. The -G option does nothing before Postfix 2.3.
INSPECT_DIR=/home/mv/postfix-filter
SENDMAIL="/usr/sbin/sendmail -G -i -o content_filter= -f" # NEVER
NEVER NEVER use "-t" here.

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15

echo SENT "$@"

mkdir -p $INSPECT_DIR

# Start processing.
cd $INSPECT_DIR || {
    echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }

cat >in.$$ || {
    echo Cannot save mail to file; exit $EX_TEMPFAIL; }

# Specify your content filter here.
java -jar /home/mv/deploy/postfix/StoreMail.jar SENT "$@" <in.$$ || {
    echo Message content rejected; exit $EX_UNAVAILABLE; }

cat in.$$ >> mailz-what-is-going-on

$SENDMAIL "$@" <in.$$

exit $?

-------

End snippets..

-tim

Reply via email to