Created
October 10, 2013 01:11
-
-
Save webbj74/6911428 to your computer and use it in GitHub Desktop.
Devel 6.x-1.27's mail wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Devel 6.x-1.27's mail wrapper | |
// $conf['smtp_library'] is set to path/to/devel.module | |
// Only define our mail wrapper if the devel module is the current mail | |
// wrapper. | |
if (variable_get('smtp_library', '') == drupal_get_filename('module', 'devel')) { | |
/** | |
* Log the mails sent out instead of mailing. | |
*/ | |
function drupal_mail_wrapper($message) { | |
$mimeheaders = array(); | |
foreach ($message['headers'] as $name => $value) { | |
// the check_plain nicely encodes <> chars for web presentation | |
$mimeheaders[] = check_plain($name .': '. mime_header_encode($value)); | |
} | |
watchdog( | |
'devel', | |
'Mail sent:<br />Id: %mail_id<br />To: %to<br />From: %from<br />Language: %lang<br />Subject: %subject<br />Body: %body<br /><br />Additional headers: <br />!header', | |
array( | |
'%mail_id' => $message['id'], | |
'%to' => $message['to'], | |
'%from' => $message['from'], | |
'%lang' => $message['language']->language, | |
'%subject' => $message['subject'], | |
'%body' => $message['body'], | |
'!header' => implode("<br />", $mimeheaders), | |
WATCHDOG_INFO, | |
) | |
); | |
return TRUE; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment