I'm not sure if SF is the good place for that, so sorry if it's not the case.
I'm administrating a Debian server for our company's emails and I'm trying to have the emails flagged as spam by Spamassassin to go in a dedicated folder for each user (like Spam/ or Junk/) but I can't manage to do it. I already have Postfix and SpamAssassin running well (SA flags the spam emails in the subject field properly), but now I must set a Procmail filter to put them where I want.
Here is what I have :
In my /etc/postfix/master.cf, I have a SA rule :
spamassassin unix - n n - - pipe
user=spamd argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}
I tried to add a rule for my spam filtering :
spamfilter unix - n n - - pipe
flags=Rq user=vmail argv=/usr/bin/procmail -Y -m /etc/postfix/procmail-spamassassin.rc
And my /etc/postfix/procmail-spamassassin.rc :
SHELL=/bin/sh
LOGFILE=/var/log/procmail.log
VERBOSE=yes
LOGABSTRACT=all
:0
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Junk
But it doesn't work and I can't understand why… I have no output in procmail.log so I can't figure how to debug that (my Postfix log doesn't give more). postfix reload
seems to ignore my changes.
I tried many others configurations, like having a mailbox_command
in my main.cf to use Procmail, and it isn't better… For information, we use Postfix virtual mailboxes (mailboxes are stored in MySQL, not mapped with Unix accounts).
I know Procmail can run this way cause I have a similar vacation filter in my master.cf and It works :
vacation unix - n n - 10 pipe
flags=Rq user=vacation argv=/usr/bin/procmail -Y -m /etc/postfix/procmail-global-repondeur.rc ${sender} ${recipient}
Can you see what I did wrong ?
Best Answer
Why not just have the final mail destination be procmail? There's not need to set up a different transport. Look into the
mailbox_command
value in main.cf.