HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   HOWTO-Related Questions (
-   -   Howto let procmail move spam to folder? (

oversight 21st April 2006 18:10

Howto let procmail move spam to folder?
I followed the briljant tutorial from falko and got my system up and running in notime. Thanks falko.

However, I want my spam in the folder spam. or Junkmail or..... any folder I like.
How do I implement this by using procmail?


falko 21st April 2006 18:56

Have a look here:

oversight 21st April 2006 21:45

hi falko,

I followed your howto with postfix, virtual users, domains, clamav spamassassin etc.

can youtell me howto do this with the this setup?

falko 22nd April 2006 17:20

I haven't tested, but you can try to do this:


postconf -e 'mailbox_command = /usr/bin/procmail'
/etc/init.d/postfix restart

Then create a global procmail recip /etc/procmailrc.

sjau 22nd April 2006 17:24

does a local .procmailrc folder in the email users "Home Mail" folder always work or does that need to be enabled?

falko 22nd April 2006 17:49

It should always work with system users, however overdight is using virtual users, that's why I suggest a global procmailrc.

todgerme 23rd April 2006 15:58

i suspect the way around this problem is to pass the particular domain through a different MDA. I'm not sure if Postfix even looks at .forward files when using Virtual Users so I'm not convinced you can call Procmail with a .forward file.
I have repeatedly tried to get .forward files working but no look yet with Virtual users:
A quick show of the Postfix defaults shows:
# postconf -d | grep .forward
forward_path = $home/.forward${recipient_delimiter}${extension}, $home/.forward
I have tried specifying all sorts in the forward but it just seems to ignore whatever I do.

Also I have read in a few places that the Procmail command only works for local users and not Virtual Users so I'n not convinced a Global procmail script will work although never say never.

So two ways forward I can see:

The Postfix conf shows virtual_transport = virtual, we could change this maildrop or procmail, however that will mean all mail will be delivered using these agents and maildrop for example can't make its own directories the way the Postfix virtual agent does so it's probably best to leave this as is.

So like the way you can pass mail off to Yaa to get an autoresponders through the transport layer, I would suggest the same but passing it off to Maildrop/Procmail. Obviously a Procmail entry would need to be made in the file but there should already be an entry for maildrop. In addition you'll need to create a maildroprc file in /etc to reflect users directories and tell it to check for maildroprc files in the various home directories but I don't think that should be a big issue. One further idea would be to try and enable Mysql Virtual users in the maildrop source for Debian, a simply configure switch can have Maildrop looking at the database. From there, the exisiting guide will need to be modded so that it gets its maildir information from the database and not from concats of the email address on top of the vmail home directory should look like this
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr /bin/maildrop -d ${recipient}

then you should have something like -> maildrop in your transport MySQL tables.

Ignoring most of this punters guide:

look at the maildrop bit, he includes a maildrop script that would be perfect for creating the directories with maildirmake, and allowing for per domain maildrop scripts.

So a little work required but not impossible! Hope it helps

todgerme 1st May 2006 02:53

i have prepared a guide for the very thing so check it out. it was done in a real rush but i do have it working so if you run into any problems, give me a shout. next thing to do is to try and have all the filtering MySQL driven, so no need for flat files at all!!!

falko 1st May 2006 16:28

Thanks! :)

(I you find some time, can you try to format it as described here? )

todgerme 1st May 2006 16:39

yeah already have plans to smarten it up, it reads awful, done in a big rush! I'm gonna add one for the Yaa autoresponder too and that should stop two of the biggest questions on this forum!

All times are GMT +2. The time now is 08:56.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.