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

romca’s picture

thanks, I think i will prepare a template for the mail so that you can alter it easily (and will solve this)
best,

pursuitofliberty’s picture

same 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

glenns’s picture

Hi 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.

if ($message['id'] == 'ejournal_action_send_email') {
   $message['body'][] = 'This e-mail was generated by e-journal module';
}

The message ID comes from the first two parameters that you pass to drupal_mail() when you trigger the email.

glenns’s picture

Priority: Minor » Normal

I think this should be higher than minor priority because it breaks most emails generated from Drupal.

romca’s picture

Status: Active » Fixed

thank you very much Glenn,
you help is much appreciated,

gwolf’s picture

Any 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,

Status: Fixed » Closed (fixed)

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