I've created a D7 implementation of the SMTP stuff for Devel.

It still probably needs a little love in the documentation department, but here's the deal:

variable_set('mail_system', array('default-system', 'DevelMailLog'));

Enables it. Unless you set anything else mails are saved to files/mails/$to-$subject-$datetime.mail.txt

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');

Currently, only those three tokens are supported, and NOT through token module.

I also added a test which is *almost* a pure unit test, but because of the variable_get's couldn't use the DrupalUnitTest base class ;(

#1 develmail-625062-1.patch4.48 KBJacobSingh
FAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to checkout from [:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal]. View


JacobSingh’s picture

Title: Fake Mail Library for sending mails to a text file. » Fake Mail Library for sending / logging mails to a text file to debug
4.48 KB
FAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to checkout from [:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal]. View

Heh, added some more keywords to the header, and attached the patch.

greggles’s picture

Status: Active » Needs review
rfay’s picture

It was my impression that Moshe was not going to put mail stuff in devel any more. Maybe this should be in its own module?

JacobSingh’s picture


kbahey’s picture

Would something like http://drupal.org/project/reroute_email do the trick?

JacobSingh’s picture


Well, I guess we can decide what to do now. I didn't realize there was a separate module for this same thing. Devel used to do it, I figured it still should.

This is D7 compat, but was written a month or so ago, so who knows now. Also, I wrote a test.

I'm fine ditching the code, but what about merging reroute_email into devel? It seems like a fairly lightweight module that doesn't really have many standalone applications.

What do devel maintainers think?

IF we go the other way, is any of this code re-usable in reroute_email?


moshe weitzman’s picture

The use cases for rerouting email are far beyond just developers. I'd like to keep the modules separate.

moshe weitzman’s picture

Project: Devel » Reroute Email
Version: 7.x-1.x-dev » 6.x-1.x-dev
Component: devel » Code

Reassigning to reroute email project. Hopefully it can use the test code here, at least.

moshe weitzman’s picture

Project: Reroute Email » Devel
Version: 6.x-1.x-dev » 8.x-1.x-dev
Component: Code » devel
Assigned: Unassigned » moshe weitzman
Category: feature » task
Status: Needs review » Fixed

I needed this functionality and all the other modules that do similar stuff have a release status of 7.x-1.x-alpha-beta-at-the-beach. so, back into devel it goes.

committed to 8.x and 7.x with some minor modernizing. thanks for the patch and sorry for the delay.

turn it on with this code in settings.php

$conf['mail_system'] = array(
  'default-system' => 'DevelMailLog',

rfay’s picture

Hmm. Reroute Email has been in fine shape for a very long time. I guess time to ask kbahey to make a release.

rfay’s picture

robertom’s picture

thanks, this is very useful

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Matt B’s picture

I've installed the devel module (both 7.x-1.2 and the dev version) and updated the settings.php file. when I send a mail via the contact form I get a "Your message has been sent." message, but I cannot find a 'mail' folder in either the private or public files directory with the mails in.

moshe weitzman’s picture

As stated at top of devel.mail.inc, we log to the temp directory that is configured for drupal. that one is rarely exposed to the web so no sensitive info is likely to leak.

Matt B’s picture

Thanks - I can see the mails there - this is a really useful tool!

rfay’s picture

I should mention, @moshe weitzman, that reroute_email now has a release :-) No changes, but does have an official release.