Having a problem with piping emails from postfix to shell script. Here's the setup:
Ubuntu 12.10, Postfix with MySQL Virtual Users (followed this guide
I have domain example.com which I am hosting email for. When an email comes in for example.com, if a virtual user exists for the to address then send the email normally. If the user doesn't exist, pipe the email to a script.
I have set up a transport for example.com and defined it in master.cf to pipe the email to the script. The script checks if a user exists for the To address and acts accordingly. The problem is that if the user doesn't exist, the email never makes it to my transport. Instead I get "user unkown in virtual alias table" in mail.log.
So the question is, how can I tell postfix not to reject email for unkown users on a specific domain, or is that even possible?
btw, I know that adding a catchall alias for the domain will solve this, but it doesn't work in my setup as I need to preserve the To address, and a catchall alias changes the to address to the catchall.
Thanks in advance for any help