> FILTER_README has examples for doing that with /usr/sbin/sendmail
> and with SMTP.


Has anybody ever made that example work?

There's no way.

post_queue_content_filter    unix    -       n       n       -       -
      pipe
        flags=Rq user=myuser null_sender=
        argv=/home/postfix/app/tools/postfix-filter.sh -f ${sender} --
${recipient}


/home/postfix/app/tools/postfix-filter.sh:
-----
#!/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=/var/spool/filter
SENDMAIL="/usr/sbin/sendmail -G -i" # 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

# 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.
# filter <in.$$ || {
#   echo Message content rejected; exit $EX_UNAVAILABLE; }

$SENDMAIL "$@" <in.$$

exit $?
-----

master.cf:
smtp      inet  n       -       n       -       -       smtpd
  -o content_filter=post_queue_content_filter:dummy


mail.log:

Jan  4 17:41:54 lab postfix/pipe[2027085]: EE5D013E179F:
to=<mail...@iarn.net>, relay=post_queue_content_filter, delay=1.1,
delays=0.04/0/0/1, dsn=4.3.0, status=deferred (temporary failure.
Command output: postdrop: error: untrusted configuration directory
name: /etc/postfix/ postdrop: fatal: specify
"alternate_config_directories = /etc/postfix/" in /etc/postfix/main.cf
sendmail: warning: command "/usr/sbin/postdrop -r" exited with status
1 sendmail: fatal: x...@xx.net(5001): unable to execute
/usr/sbin/postdrop -r: Success )



Thanks!

BR,
Rafael

Reply via email to