About
Disable Mail is a module which allows you to disable outgoing mail on your site. You can do this for all mail, or specify which modules this should apply to.
This works by providing a MailSystemInterface. A MailSystemInterface is a mail handler. This means that when any module or the system sends mail, this handler decides what to do. The default handler sends mail using PHPs mail functions while others store the mail in a log file. This handler simply does nothing and reports a success to the system.
Set Up
To enable this feature, the user needs to enable the module and then set their configuration in the settings.php file. Below are some examples of how to set these settings up. The basic idea is that we are setting a Drupal configuration variable that lists the various handlers Drupal and modules should use.
Here is an example of a setting in settings.php. This line can be added anywhere in that file.
$conf['mail_system'] = array(
'default-system' => 'DisableMail',
);
The above settings sets the "mail_system" default to "DisableMail" (the MailSystemInterface included in this module).
You could also add a conditional arguement such as:
<?php
if ($_SERVER['HTTP_HOST'] === "example.com") {