I’m developing a web application in PHP, and my Macbook, running Snow Leopard, is actually sending emails when PHP’s mail() function is called. It’s emailing customers, and that’s BAD.
I COULD prevent this in my code, but I’d rather just disable mailing for my machine. Is there a way to do this under Mac OS?
I typically use a wrapper class for mail() that checks for a constant (something like DEBUG_MODE) and sends the email to me instead of the original recipient (and includes all of the original recipients in the mail body so I can confirm things are working). It’s a bit of extra work the first time, but it means I don’t have to worry about sending email to “real” people but I still know things are working.
I’ve posted a simple example. It could use a lot of improvements (header handling, making sure cc and bcc fields also get stripped), but it’ll get you most of the way home.