Prevent accidentally sending mails from your development environment

When you're, like me, using Windows as your development environment, letting your Drupal environment send mails can be a big challenge. This in contrast to a Linux/Mac OS X based system, where it is much easier to send mails. I think too easy... I've lost the count how many times a colleague has sent an apology mail when he/she had accidentally sent test mails to existing e-mail addresses, whoops! So, I do like that it's more difficult on Windows to send mails.

A solution that is often used is to install a module such as Reroute Email and configure the settings using Configuration Split. However, you are still vulnerable for easy mistakes (e.g., forgetting you have loaded the settings of the acceptance environment, which is able to send mails). In addition to this solution, I always have Papercut installed. Papercut acts as the (local) SMTP server, but instead of sending the mails to the provided addresses, it provides a GUI to see the contents of the mail. So, email sent from Drupal never leaves your development environment.

Development environment setup