From 362564061f5cb279e85f3cbe252403e005dcb98c Mon Sep 17 00:00:00 2001
From: NROTC_Webmaster <NROTC_Webmaster@1030166.no-reply.drupal.org>
Date: Sun, 29 Jan 2012 18:00:21 -0500
Subject: [PATCH 4/4] php-errors-blank-email-1189306-13

Signed-off-by: NROTC_Webmaster <NROTC_Webmaster@1030166.no-reply.drupal.org>
---
 php_errors.module |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/php_errors.module b/php_errors.module
index 026690b..e10e194 100644
--- a/php_errors.module
+++ b/php_errors.module
@@ -203,7 +203,7 @@ function _php_errors_archive_view($rid) {
   return $output;
 }
 
-/* Uses Cronplus module to do a couple weekly tasks:
+/* Uses Cronplus module to do a couple tasks:
  *     - send email notifications to selected users (frequency based on frequency setting)
  *     - archive the error report (weekly)
  */
@@ -243,7 +243,7 @@ function php_errors_cronplus_monthly($now, $last_cron, $last_this) {
 // email summary report to selected users
 function _php_errors_send_notifications() {
   $site_name = variable_get('site_name', 'Your Site');
-  $params['from'] = "$site_name <". variable_get('site_mail', ini_get('sendmail_from')) .'>';;
+  $from = "$site_name <". variable_get('site_mail', ini_get('sendmail_from')) .'>';;
 
   // pull list of all user in selected roles
   $users = _php_errors_get_roles_emails();
@@ -267,10 +267,10 @@ function _php_errors_send_notifications() {
   }
   $recipients = join(",", $emails);
 
-  $params['subject'] = t("PHP Error Summary Report");
-  $params['body'] = _php_errors_email();
-
-  if (drupal_mail('php_errors', 'php_error_report', $recipients, language_default(), $params)) {
+  // build the message for sending
+  $message = drupal_mail('php_errors', 'php_error_report', $recipients, language_default(), $params, $from);
+  // send the confirmation mail
+  if ($message['result']) {
     watchdog('action', 'Sent email to %recipients', array('%recipients' => $recipients));
   }
   else {
@@ -278,6 +278,11 @@ function _php_errors_send_notifications() {
   }
 }
 
+function php_errors_mail($key, &$message, $params) {
+  $message['subject'] = t("PHP Error Summary Report");
+  $message['body'] = _php_errors_email();
+}
+
 // get array of all email addresses for each user in selected roles
 function _php_errors_get_roles_emails() {
   $emails = array();
-- 
1.7.7.GIT

