Download & Extend

Fake Mail Library for sending / logging mails to a text file to debug

Project:Devel
Version:8.x-1.x-dev
Component:devel
Category:task
Priority:normal
Assigned:moshe weitzman
Status:closed (fixed)

Issue Summary

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 ;(

Comments

#1

Title:Fake Mail Library for sending mails to a text file.» Fake Mail Library for sending / logging mails to a text file to debug

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

AttachmentSizeStatusTest resultOperations
develmail-625062-1.patch4.48 KBIdleFAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to checkout from [:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal].View details

#2

Status:active» needs review

#3

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?

#4

bump!

#5

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

#6

d'oh!

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?

Best,
Jacob

#7

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

#8

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.

#9

Project:Reroute Email» Devel
Version:6.x-1.x-dev» 8.x-1.x-dev
Component:Code» devel
Category:feature request» task
Assigned to:Anonymous» moshe weitzman
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

<?php
$conf
['mail_system'] = array(
 
'default-system' => 'DevelMailLog',
);
?>

#10

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

#11

#12

thanks, this is very useful

#13

Status:fixed» closed (fixed)

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

#14

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.

#15

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.

#16

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

#17

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

nobody click here