How do I set up a subdomain in Postfix just with the purpose to receive forwarded emails and pipe them to a PHP script?
How to set up a subdomain in Postfix just to receive forwarded emails and pipe them to a PHP script?
-
Roger, as long as you don't need to receive your mails in "real-time", going with the fetchmail solution suggested in your previous question is much easier.– SvenFeb 6, 2011 at 10:49
-
Real time is really a need, otherwise I'd use a cronjob to check Google Apps via IMAP. That's why I think it's better for me to have the emails forwarded and then imediatly piped by Postfix to a script that will trigger an action based on the e-mail contents.– RogerFeb 6, 2011 at 10:56
2 Answers
It sounds like you want to setup a post queue filter. Documentation on this is here -> http://www.postfix.org/FILTER_README.html
the link that ttyS0 gave doesn't give any examples of how to do this in PHP, it's just a general overview page.
I found this tutorial: http://blog.thecodingmachine.com/content/triggering-php-script-when-your-postfix-server-receives-mail
which will tell you how to push the email into a php script, unfortunately it doesn't go far enough and I don't know how to push the email back to postfix afterwards in case it didnt meet my criteria for filtering.
so what happens is, I can't login, I can't check mail, it effectively blackholes the entire server, it's only useful when you want to run a deadend server to recieve and store email, not to actually use it in conjunction with a real server running user accounts, normal email delivery etc.