From 046109764822c0e91c0fdf3ca3822a37697e2d9e Mon Sep 17 00:00:00 2001
From: James Silver <jamsilver@gmail.com>
Date: Wed, 9 May 2012 10:49:22 +0100
Subject: [PATCH] Issue #1568680 by jamsilver: Pass message to theme function/template.

---
 mimemail.module          |    2 +-
 theme/mimemail.theme.inc |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mimemail.module b/mimemail.module
index 0e919f6..933f413 100644
--- a/mimemail.module
+++ b/mimemail.module
@@ -475,7 +475,7 @@ function mimemail_prepare_message($message) {
 
   $subject = str_replace("\n", '', trim(drupal_html_to_text($subject)));
   $key = str_replace('_', '-', $key);
-  $body = theme(array('mimemail_message__' . $key, 'mimemail_message'), array('key' => $key, 'recipient' => $to, 'subject' => $subject, 'body' => $body));
+  $body = theme(array('mimemail_message__' . $key, 'mimemail_message'), array('key' => $key, 'recipient' => $to, 'subject' => $subject, 'body' => $body, 'message' => $message));
 
   foreach (module_implements('mail_post_process') as $module) {
     $function = $module . '_mail_post_process';
diff --git a/theme/mimemail.theme.inc b/theme/mimemail.theme.inc
index 9742123..749d357 100644
--- a/theme/mimemail.theme.inc
+++ b/theme/mimemail.theme.inc
@@ -10,7 +10,7 @@ function mimemail_theme_theme() {
 
   return array(
     'mimemail_message' => array(
-      'variables' => array('key' => NULL, 'recipient' => NULL, 'subject' => NULL, 'body' => NULL),
+      'variables' => array('key' => NULL, 'recipient' => NULL, 'subject' => NULL, 'body' => NULL, 'message' => array()),
       'template' => 'mimemail-message',
       'pattern' => 'mimemail_message__',
       'file' => 'mimemail.theme.inc',
-- 
1.7.1

