Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I tried to use the contact form I received the following message
Warning: implode() [function.implode]: Invalid arguments passed in DefaultMailSystem->format() (line 23 of /home/french2/public_html/ebhc2014.org/modules/system/system.mail.inc).
I had the same problem when using the admin/people module when sending an account activation message to a new user
Location http://ebhc2014.org/?q=user/160/edit&destination=admin/people
Referrer http://ebhc2014.org/?q=user/160/edit&destination=admin/people
Message Warning: implode() [function.implode]: Invalid arguments passed in DefaultMailSystem->format() (line 23 of /home/french2/public_html/ebhc2014.org/modules/system/system.mail.inc).
It is repeatable by switching mail logger on and off
Using Drupal 7.15
Comment | File | Size | Author |
---|---|---|---|
#5 | mail_logger-blank_body-1740066-6704284.patch | 41.36 KB | deetergp |
#6 | mail_logger-blank_body-1740066-6705392.patch | 2.76 KB | deetergp |
#3 | mail_logger.patch | 2.14 KB | Rick G |
#2 | mail_logger.patch | 2.1 KB | Rick G |
Comments
Comment #1
thirdboxcar CreditAttribution: thirdboxcar commentedSame issue. I'm trying to use it with Webform, but whenever I enable Mail Logger I get the above error.
Comment #2
Rick G CreditAttribution: Rick G commentedThis is because mail_logger_mail_alter changes the message body to a string, when the DefaultMailSystem class expects an array.
The attached patch fixes this issue, as well as changing the logging behavior to log only messages that are flagged to 'send' rather than simply 'build'
Comment #3
Rick G CreditAttribution: Rick G commentedI saw another solution to this problem in issue 1622878 that uses the mail system to format the message body.
The attached patch incorporates elements from my patch above and the patch from the other issue.
Comment #4
deetergp CreditAttribution: deetergp commentedI get a very similar error when I have mail_logger installed on a fresh (or otherwise) install of Drupal 7.16. I install Drupal, install mail_logger and enable it, then switch to an incognito browser window and create a new account. Once account creation redirects me to the "Thank you for registering for an account." message it also includes two of the following warnings:
Warning: implode() [function.implode]: Invalid arguments passed in DefaultMailSystem->format() (line 23 of /Users/XXXXXX/Projects/education/drupal-7/public_html/modules/system/system.mail.inc).
The account gets created and an email gets sent, but the email has no body text at all. Interestingly enough, the outgoing body text does get logged in mail_logger, it just doesn't get passed on to the outgoing email. It was this behavior that initially caught my attention, I noticed it before taking note of the warning message. (In fact, I am not entirely certain I got the warning the first time I noticed the lack of body text)
I tried the above patch thinking it would at least get rid of the warnings I was getting when I went to create a new account, but it did not.
Edit: I did a
git apply -stat
rather thangit apply
which ran successfully but did not actually apply the patch. When I tried to justgit apply
the patch, it errored out witherror: sites/all/modules/mail_logger/mail_logger.new.module: No such file or directory
.Comment #5
deetergp CreditAttribution: deetergp commentedSince I had difficulty applying the (2nd) patch, I took the code Rick G wrote and applied by hand to a fresh install of mail_logger in a fresh Drupal 7 install and found that it did indeed get rid of the warning message and put the body content back into outgoing emails. I rolled it into a new patch, which I tested locally and had no issues applying. I think it is ready for someone else to have a look at it and hopefully have it rolled back into the mail_logger codebase.
Edit: Ignore this patch, see the next comment for the one to use.
Comment #6
deetergp CreditAttribution: deetergp commentedOkay. My apologies, I am kinda figuring this patch stuff out myself.
Please ignore my previous patch, it was diffed against a master branch that did not have mail_logger installed, so the patch contained all the mail_logger files. This new patch is smaller and contains nothing but just the changes to mail_logger.module. I have tested it against a clean clone of the mail_logger repo and a clean install of Drupal 7.16. The new patch is ready to be tested.
Comment #7
tlattimore CreditAttribution: tlattimore commentedI have functionally tested the patch from #6 and can confirm that it resolves the issue reported here. RTBC.
Comment #8
deetergp CreditAttribution: deetergp commentedThis patch has been rolled back into 7.x-1.x-dev. I have installed mail_logger using
drush dl mail_logger
and pulled it down as a part of the Guardr distro and verified that it worked in both instances. I am calling this one fixed.