A new version (alpha 6), and it displays just an empty message (HTML).

Removal of $subject argument (theme() function) in line 128 of mimemail.module (probably related to #752838: Pass $subject to the template) seems to resolve the issue.

Comments

sgabe’s picture

Clearing the caches will solve the problem.

luti’s picture

I've ran update.php after updating. This should already clear the cache, or?

Now, I've tried to manually clear the cache (Administer -> Performance -> "Clear cached data" button). No success either (as long as $subject argument is there).

sgabe’s picture

This should be a cache issue. I think you get the $mailkey - which was the second parameter before - as $body, but it is empty so you don't see anything. Please clear the browser's cache too.

luti’s picture

Cleared that too. No success... :-(

$mailkey is empty. But, $mailkey was the 3rd parameter before (2nd was $body).

sgabe’s picture

Can you reproduce this on a clean install?

Before:

  return array(
    'mimemail_message' => array(
      'arguments' => array('body' => NULL, 'mailkey' => NULL),
      [...]

After:

  return array(
    'mimemail_message' => array(
      'arguments' => array('subject' => NULL, 'body' => NULL, 'mailkey' => NULL),
      [...]

So now you get the $mailkey as $body, try using $subject instead of $body in the template, let see what happens.

luti’s picture

Hi,

I am not sure I understand you well...

I've replaced a complete mimemail folder (with all subfolders), version alpha5 (which worked well) with alpha6 (which is sending an empty message).

In new theme/mimemail.theme.inc, version 1.9, it is like you write ("After", with 'subject' => NULL). In the old alpha5, version 1.6, it was as your "Before" (without 'subject' => NULL).

After the replacement, I've gone through /update.php process, manually cleared the Drupal cache (Administer -> Performance -> "Clear cached data" button) and cleaned Firefox cache as well.

I've edited theme/mimemail-message.tpl.php replacing $body with $subject (line 35).

Message arrived practically the same. But, it is not empty (my mistake in my initial post!) - it contains a node subject (instead of a node body).

I've printed out variables before and after $body = theme(...) call in line 128 (within mimemail.module file). $body gets a subject of node appended instead of a node body (sound reasonable to me, if I pass it instead of a body to the function...) and not the opposite (as you've suggested to try in template).

Are you sure $subject has to be the 2nd argument (and, $body the 3rd one, instead of 2nd as before...) of a theme function call in line 128 now? Considering the theme() function hasn't change, or?

Should maybe a closing bracket of array() in line 128 be moved after $subject - so the $subject is the 3rd item of the 1st argument (array)? Trying to do that, I am getting mail well (as expected)...

sgabe’s picture

Are you sure $subject has to be the 2nd argument (and, $body the 3rd one, instead of 2nd as before...) of a theme function call in line 128 now? Considering the theme() function hasn't change, or?

Yes, I am sure. See hook_theme() in the API documentation: The arguments must be in the same order that they will be given to the theme() function.

  return array(
    'mimemail_message' => array(
      'arguments' => array('subject' => NULL, 'body' => NULL, 'mailkey' => NULL),
      [...]

$body = theme(array('mimemail_message__'. $mailkey, 'mimemail_message'), $subject, $body, $mailkey);

The order of the arguments is right.

Should maybe a closing bracket of array() in line 128 be moved after $subject - so the $subject is the 3rd item of the 1st argument (array)? Trying to do that, I am getting mail well (as expected)...

Definitely not. The first parameter of theme() is $hook - the name of the theme function to call - which may be an array to provide 'fallback' theme implementation. The $subject can't be an element of that array.

However it's odd that more than 5000 sites uses alpha6 by now and so far no one else encountered this pretty big bug...

luti’s picture

Thank you for your feedback. Made me think again, and I hope I've finally resolved it...

Sorry for the mess, it was obviously a function phptemplate_mimemail_message() (which was together with simplenews.css in my custom theme template.php; I haven't even remember to put it there in the past).

I've removed it, and use mimemail_message.tpl.php / simplenews-newsletter-body.tpl.php and mail.css instead. Seems to work fine now (altough I have to test it a bit more, I think).

luti’s picture

Status: Active » Closed (works as designed)