Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I set up a subdomain in Postfix just with the purpose to receive forwarded emails and pipe them to a PHP script?

share|improve this question
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. –  Sven Feb 6 '11 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. –  Roger Feb 6 '11 at 10:56

2 Answers 2

up vote 1 down vote accepted

It sounds like you want to setup a post queue filter. Documentation on this is here -> http://www.postfix.org/FILTER_README.html

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.