Redirecting all mail from Sendmail on PHP

Making websites, eh? Trying to write something for use on your testing server without bombarding your database victims with development spam? You need.. slurp mail! (ahem)

Here’s how to write your own sendmail client that’ll redirect all emails to the address of your choice. Create /usr/sbin/slurpmail and stick this in it!

formail -R cc X-original-cc \
-R to X-original-to \
-R bcc X-original-bcc \
-f -A"To:" \
| /usr/sbin/sendmail -t -i

Chmod it to make it -rwxr-xr-x. Then in php.ini find the sendmail path line that reads /usr/sbin/sendmail -t -i and change it to slurpmail!

Rock and/or Roll! We are now getting all the mails that would have went to god knows who! yay! Mind and restart Apache now first!