If email message body is an array the mail() function in drupal_send_mail causing an error because a string is expected. This is because the Messaging mail handling are passing by drupal_mail which have a check for this. I think it will be a good idea to wrap the body in messaging_mail_prepare. I have added the following line after the alter mail call:

$mail['body'] = is_array($mail['body']) ? implode("\n\n", $mail['body']) : $mail['body'];

Is there any specific reason why drupal_wrap_mail is not called?

Comments

mnlund’s picture

Title: Email body as an error causing error » Email body as an array causing error