For debugging, I'd like to print the values being used to send e-mail messages to the screen.
After enabling the devel module, I tried this code (modified as per Letharion's comment):
function MY_MODULE_mail_alter(&$message) {
dpm($message, 'email_test');
}
I don't get any error message, but I don't see any output, either. How can I print the value of '$message' to the screen?
More details about my site:
I'm trying to debug the e-mails sent upon user registration. There should be one sent by Drupal itself via the Logintoboggan module and another sent by the Rules module.
Anonymous users have the same permissions as admin to view debug messages; I tested this by adding a dpm()
in my page.tpl.php
.
I tried setting Display redirection page
to on as per Clive's comment but the workflow is unchanged from before. If I add debug($message)
to the MY_MODULE_mail_alter()
then debug()
will print the message from Drupal/logintoboggan but not the message from Rules.
dpm($var, 'Some title');
when your output doesn't show. A blank (NULL, False) $message won't show up otherwise, and you won't know whether it's blank or if the code never executed. – Letharion May 22 '12 at 11:44