Index: pm_email_notify/pm_email_notify.module =================================================================== --- pm_email_notify/pm_email_notify.module (revision 1695) +++ pm_email_notify/pm_email_notify.module (working copy) @@ -147,6 +147,7 @@ function pm_email_notify_privatemsg_mess if (_pm_email_notify_is_enabled($recipient->uid)) { // send them a new pm notification email if they did $params['recipient'] = $recipient; + $params['message'] = $message; drupal_mail('pm_email_notify', 'notice', $recipient->mail, user_preferred_language($recipient), $params); } } @@ -158,6 +159,7 @@ function pm_email_notify_privatemsg_mess function pm_email_notify_mail($key, &$message, $params) { $language = $message['language']; $variables = user_mail_tokens($params['recipient'], $language); + $variables = array_merge($variables, _pm_email_notify_token($params['message'])); switch ($key) { case 'notice': $message['subject'] = t(variable_get('pm_email_notify_subject', 'New private message at !site.'), $variables, $language->language); @@ -167,8 +169,29 @@ function pm_email_notify_mail($key, &$me } /** + * Return an array of token to value mappings for user e-mail messages. + * + * @param $message + * The private message array being sent. Must contain at + * least the fields 'author', 'subject', and 'body'. + * @return + * Array of mappings from token names to values (for use with strtr()). + */ +function _pm_email_notify_token($message) { + + $tokens = array( + '!author' => $message['author']->name, + '!pm_subject' => $message['subject'], + '!pm_body' => $message['body'], + ); + + return $tokens; + +} + +/** * Returns default email notification body. */ function _pm_email_notify_default_body() { - return "Hi !username,\n\nThis is an automatic reminder from the site !site. You have received a new private message.\n\nTo read your message, follow this link:\n!uri/messages\n\nIf you don't want to receive these emails again, change your preferences here:\n!uri/messages/notify"; + return "Hi !username,\n\nThis is an automatic reminder from the site !site. You have received a new private message from !author.\n\nTo read your message, follow this link:\n!uri/messages\n\nIf you don't want to receive these emails again, change your preferences here:\n!uri/messages/notify"; } \ No newline at end of file