From 320fa675acda8f4c7a07e3dac0446ced7b4fad2c Mon Sep 17 00:00:00 2001
From: Jesse Norell <jesse@kci.net>
Date: Thu, 5 Nov 2020 16:11:43 -0700
Subject: [PATCH] fix quota notification mail

---
 server/lib/classes/monitor_tools.inc.php | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 31e36836d5..e473472207 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -829,6 +829,7 @@ class monitor_tools {
 
 		//* get mail headers, subject and body
 		$mailHeaders = '';
+		$mailFrom = '';
 		$mailBody = '';
 		$mailSubject = '';
 		$inHeader = true;
@@ -844,6 +845,16 @@ class monitor_tools {
 					$mailSubject = trim($parts[1]);
 					continue;
 				}
+				if(strtolower($parts[0]) == 'From') {
+					$mailFrom = trim($parts[1]);
+					continue;
+				}
+				if(strtolower($parts[0]) == 'Cc') {
+					if (! in_array(trim($parts[1]), $recipients)) {
+						$recipients[] = trim($parts[1]);
+					}
+					continue;
+				}
 				unset($parts);
 				$mailHeaders .= trim($lines[$l]) . "\n";
 			} else {
@@ -858,7 +869,7 @@ class monitor_tools {
 		$mailBody = strtr($mailBody, $placeholders);
 
 		for($r = 0; $r < count($recipients); $r++) {
-			$app->functions->mail($recipients[$r], $mailSubject, $mailBody, $mailHeaders);
+			$app->functions->mail($recipients[$r], $mailSubject, $mailBody, $mailFrom);
 		}
 
 		unset($mailSubject);
-- 
GitLab