Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to test an application which sends mail in PHP on my local server and need some way to redirect emails to output to files rather than actually sending them.

I've searched google extensively, and it appears that the solution varies with OSX 10.4 and 10.5, and I can't find any info for 10.6 which I am currently using.

One solution would be to rewrite my code to send output to files while a development flag is on, however I would also like to redirect emails sent from local Wordpress installations without hacking the wordpress core.

Anybody have any experience with this?

share|improve this question
It won't help with postfix, but there are some useful testing MTAs mentioned on this question. You could adjust your PHP config to use a test mail servers. – Zoredache Jan 27 '11 at 3:15

Postfix allows you to hook in a content filter (more info at This could be a script that writes the contents somewhere on disk and send it back to postfix for further delivery. The FILTER_README.html shows a simple shell script that you could extend.

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.