Having updated to version 7.x-1.0-Alpha1 I get the following message when I send an email:
Warning: trim() expects parameter 1 to be string, array given in mimemail_mail() (line 268 of .../sites/all/modules/mimemail/mimemail.module).

Looking at the source file, line 268 reads:
$attachments_string = trim($params['attachments']);
However, if I am reading the code correctly, line 247 of the same file is defining element 'attachments' as an array in its own right, consequently line 268 is trying to trim an array, not a string! (I am assuming here that function mimemail_rules_action_info() defines the structure of array $params)

The email was created using mass_messaging 7.x-1.0-beta2 and mimemail 7.x-1.0-Alpha1, views 7.x-3.2 and sent using Rules 7.x-2.0. The email did not have an attachment!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sgabe’s picture

Project: Mime Mail » Mass Messaging
Version: 7.x-1.0-alpha1 » 7.x-1.x-dev

I am moving this to Mass Messaging and copying my explanation from #1428798: Attachments reset in $params since this is the same case. Mime Mail implements hook_mail() in favor of Rules support and no other module should call drupal_mail('mimemail', [...]).

Please take a look at drupal_mail(). The first parameter of drupal_mail() is a module name to invoke hook_mail() on. The {$module}_mail() hook will be called to complete the $message structure which will already contain common defaults.

As the README.txt says, you can send message via Mime Mail by specifing MimeMailSystem as the responsible mail system for a particular message or all mail sent by one module. This doesn't mean to call drupal_mail('mimemail', ... ). You should use the name of your own custom module which is sending the message. So your custom hook_mail() implementation will be invoked and everything will be just fine.

kovaski’s picture

Although the mail is sent, the attachments do not work. According to the answer above, would have to modify the file: mass_messaging_mail.module. Change "mimemail" function "drupal_mail" to a new module. But what can we do?

Thanks for your help.

nhck’s picture

Title: Warning: trim() expects parameter 1 to be string...line 268 of mimemail.module » mass_messaging_mail.module is unfinished
Priority: Major » Critical

Basically the mass_messaging_mail.module is an incorrect usage of mimemail. You would need to implement hook_mail which mass_messaging_mail.module does not.

Also the attachments part is commented out and replaced by a debug code in the current version.

bradjones1’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
6.02 KB

This patch adds attachment support and also addresses setting the sender.

As noted in #3, you should set the mail system to MimeMail through the admin UI.

I'll also be adding a ticket regarding maintenance of this module; it seems like there's a critical mass of users, but there hasn't been much work on this in the last 2 years.

bradjones1’s picture

FileSize
6.19 KB

An updated patch.