After upgrade of site from 5.15 to 6.10, and appropriate update of ejournal module, the sitewide contact form was sending out only:
"Array
This e-mail was generated by e-journal module"
as the message body.
Commenting out ejournal_mail_alter like so:
function ejournal_mail_alter(&$message) {
//$message['body'] .= "\n" . "This e-mail was generated by e-journal module";
}
solved the problem.
Part of the problem may be that ejournal_mail_alter is getting called when it does not need to be. In both 5.x and 6.x, it is called for the sitewide contact form, when in fact it should be only called for messages generated by ejournal.
Comments
Comment #1
romca CreditAttribution: romca commentedthanks, I think i will prepare a template for the mail so that you can alter it easily (and will solve this)
best,
Comment #2
pursuitofliberty CreditAttribution: pursuitofliberty commentedsame thing is happening to my install, with use of notifications module... and comments notify, all email messages print this message;
Array
This e-mail was generated by e-journal module
INSTEAD of the actual body content
Comment #3
glenns CreditAttribution: glenns commentedHi romca,
$message['body']
is an array, so you can't append text by doing$message['body'] .= 'my footer'
If you do that, you would end up with the string
'Array my footer'
Instead you need to use
$message['body'][] = 'my footer'
The second issue is that this function applies to all mail from Drupal. The module should check the message ID and only apply the footer to emails that have actually been generated by E-Journal.
ie.
The message ID comes from the first two parameters that you pass to
drupal_mail()
when you trigger the email.Comment #4
glenns CreditAttribution: glenns commentedI think this should be higher than minor priority because it breaks most emails generated from Drupal.
Comment #5
romca CreditAttribution: romca commentedthank you very much Glenn,
you help is much appreciated,
Comment #6
gwolf CreditAttribution: gwolf commentedAny update on when this will be fixed on a released version of this module? I much rather avoid hand-patching author's sources, but am doing so as this breaks functionality in my sites :-(
Thanks a lot,