Spam yourself. Spamalot or a spamalittle with DevelMailLog
I was upgrading The Watcher module to Drupal 7 today and found myself having to test a lot of email sending. Looking around in vain for a fake email system to log emails to the disk instead of sending them out into the interwebs to risk getting called the dreaded meat product, I decided to write one using the new pluggable mail system interface in Drupal 7.

Previous versions of this have existed in the past, but I couldn’t find anything in devel currently. Here’s how it works. If you want to save your mails locally to files:
Step 1
Install Devel
Step 2
Apply this patch (until it gets committed) – Review here: http://drupal.org/node/625062.
cd sites/all/modules/devel curl http://drupal.org/files/issues/develmail-625062-1.patch | patch -p0
Step 3
In your settings.php file:
$conf['mail_system'] = array('default-system', 'DevelMailLog');
That’s it!
Unless you set anything else mails are saved to files/mails/$to-$subject-$datetime.mail.txt
Example


Bonus
You can change the directory with
variable_set(’devel_debug_mail_directory’, file_directory_path() . ‘/mails’);
Or the file format
variable_set(’devel_debug_mail_file_format’, ‘%to-%subject-%datetime.mail.txt’);
Till next time spammers…

