November 6th, 2009

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.

Spam!

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
Contact | My Site

Terminal — bash — 140×50

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…

5 Responses to “Spam yourself. Spamalot or a spamalittle with DevelMailLog”

  1. Harry Slaughter says:

    The devel module also has a “Log Only” option under SMTP Settings in admin/settings/devel which sends all outgoing mail to the logs instead of actually out through the intratubes.

  2. Jacob Singh says:

    Hi Harry,

    This article is about Drupal 7. Does such a thing exist in D7? I don’t see it.

    Best,
    Jacob

  3. Irene Blair says:

    sheesh… sounds easy when you say it!

  4. Yesenia Sloan says:

    Came clueless, left worried. tnx for the post.

  5. Charlotte L. Howard says:

    Some interesting information on KEYWORD, thank you!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

How To find me

Telephone: +1 510.277.0891 | Email: jacobsingh at gmail daht calm

Solution Graphics