From: Petr Svacina (no email)
Date: Sun Nov 04 2007 - 10:19:50 EST
>
> using maildrop (with reformail) is probably the simplest way.
>
> It is possible to use a script like in
> http://www.postfix.org/FILTER_README.html#simple_filter
Problem solved !!! THANKS anyone for the help :-) Here is the solution:
First I did this script:
nano /var/spool/filter/subject:
#!/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.
sed -i '/Subject/s/:.*/:SPEDICE/g' in.$$ || {
echo Message content rejected; exit $EX_UNAVAILABLE; }
$SENDMAIL "$@" <in.$$
exit $?
chown -R vmail:vmail /var/spool/filter
chmod 755 /var/spol/filter/subject
After that I set up postfix master.cf file by including this lines:
subject unix - n n - 10 pipe
flags=Rq user=vmail:vmail argv=/var/spool/filter/subject -f ${sender} --
${recipient}
So the last was to define postfix access mysql table to use this fliter for
specific user only:
source access
type
FILTER subject:dummy recipient
I owe you lot of beers ... :-)
Bye, Peter
|
|
|