I'm looking to change the return-path of email so all email coming out
of our servers comes back to a common mailbox. My master.cf i have
added

filter  unix  -       n       n       -       -       pipe
  flags=Rq user=filter argv=/etc/postfix/filter -f ${sender} -- ${recipient}

My filter looks like

#!/bin/sh

# change these if needed
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail


# 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; }

/usr/bin/alter_email.py -f in.$$ || \
    { echo Message content rejected; exit $EX_UNAVAILABLE; }

# Send the email on as per the Postfix stack
$SENDMAIL "$@" <in.$$

exit $?

alter_email.py runs fine and pretty much as the following in it


cmd = "/usr/bin/altermime --input=/var/spool/filter/%s
--alter-header=\"Return-Path\"
--alter-with=\"<bounce...@return.domain.com>\" --alter-mode=replace" %
(options.email_file, email_id)
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT,
close_fds=True)



So if i leave the trap commented out in my filter file the email is
saved there and the /var/spool/filter/in.* files are correct.. but
when I get the email the return-path is never changed.

Anything I am missing?

thanks!

Reply via email to