i need procmail to place incoming mail into specific folder depending on some set of rules. I know how i can accomplish this, but i need to write static set of rules in a specific file. What i really need is to configure procmail to use rules stored in mysql database. How i can do this? I've read a bit about that and one solution i found is to pipe message to a php/perl script and return a folder name to place message. But i have completely no i idea how to use php script as a rule and then use its return value.
To "place incoming mail into [a] specific folder depending on some set of rules" is precisely what Procmail does out of the box, but I guess you are looking for something like this:
It's deceptively simple, but that's really all it takes. A command in backticks will receive the current message as its standard input.
If this is all your Procmail rules do, you might want to think about whether Procmail is at all required. The delivery part is still useful and robust, so I recommend you keep it for that, but since Procmail is good at doing precisely what you are trying to do with PHP, perhaps you want to think about your approach.
If your database doesn't change very frequently, you might want to consider using a script to generate your