the documentation for hook_mail_alter tells us about certain keys for the message array.
one of those keys is the identifier for the message:

mail_id: An id to identify the mail sent. Look into the module source codes for possible mail_id values.

but according to the code this identifier is really 'id'.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Bundle up the variables into a structured array for altering.
$message = array(
'id' => $module .'_'. $key,
'to' => $to,
'from' => isset($from) ? $from : $default_from,
'language' => $language,
'params' => $params,
'subject' => '',
'body' => array()
);

CommentFileSizeAuthor
#5 359853.patch4.86 KBjhodgdon
#3 359853.patch2.13 KBjhodgdon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kleinmp’s picture

Status: Active » Needs review

I committed this to the cvs documentation for Drupal 6. I changed references from 'mail_id' to 'id'.

jhodgdon’s picture

I fixed this up a bit more for D6 (there was still a lingering mail_id in there).

Also I noticed hook_mail doc had the same problem, so I fixed that up too.

It looks like D7 has the same issue. I'll make a patch shortly.

jhodgdon’s picture

Version: 6.6 » 7.x-dev
FileSize
2.13 KB

This patch fixes the array key problem (mail_id should be id) for D7. Also, I fixed up the formmating problem on http://api.drupal.org/api/function/hook_mail_alter/7 (turning the array keys into a bullet list, as they are on http://api.drupal.org/api/function/hook_mail/7), and removed a @return: none declaration in one of the two hooks.

To confirm that it should be id and not mail_id, check the source code for http://api.drupal.org/api/function/drupal_mail/7

Dries’s picture

Status: Needs review » Needs work

There is some inconsistent use of single quotes in the PHPdoc. Some keywords have quotes around them, whereas others don't.

jhodgdon’s picture

Status: Needs work » Needs review
FileSize
4.86 KB

Good point. When I looked more carefully at the doc for those two hooks, rather than just trying to fix the problem identified in this issue, I found a lot of other style, grammar, and clarity issues too. This patch improves both of them considerably, I think.

Note that if this patch is accepted/applied, it should also be ported to D6, so please mark the issue accordingly, thanks!

Status: Needs review » Needs work

The last submitted patch failed testing.

jhodgdon’s picture

Status: Needs work » Needs review

Setting back to Needs Review in hopes that the patch will get retested. The test bot was apparently malfunctioning (I had about 7 patches fail in that time period, all were doc, none broke the HEAD install I am pretty sure).

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks!

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev
Status: Fixed » Patch (to be ported)

Needs port to D6, or at least a look to see if it's already fixed up there.

jhodgdon’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

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