Setting up your dev environment to log, instead of send, emails

Thought I'd share this since it can help a) prevent inadvertently sending out massive emails from your dev environment and b) help you debug the emails that are going out:

put this simple script somewhere, call it dev-mailer or dev-mailer.bash or something:

cat >> /tmp/logmail.txt

Save it, chmod 755.

Now, edit your php.ini script (use phpinfo() in a web server script or php -i from the command line to find which ones are being used).

For the "sendmail_path" configuration, change it to this:

sendmail_path = /dir/to/dev-mailer.bash

Save, restart your web server.

In a new terminal do:

tail -f /tmp/logmail.txt

I'm not sure if it works with Windows.

Hope that helps.

Found this a few years ago at

--- May 28th, 2010 :: Misc ::