From 6db27748d01ef709bf61a35314a56c565545bb7f Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Mon, 11 Jun 2012 10:35:30 +0000
Subject: [PATCH] - Added CC and BCC senders to mail function. - Bugfix:
 changed "Return-Path: $form" to Return-Path: $from.

---
 interface/lib/classes/functions.inc.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index 0f29003cf8..2b11427f89 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -34,7 +34,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 class functions {
 	
 
-	public function mail($to, $subject, $text, $from, $filepath = '', $filetype = 'application/pdf', $filename = '') {
+	public function mail($to, $subject, $text, $from, $filepath = '', $filetype = 'application/pdf', $filename = '', $cc = '', $bcc = '') {
 		global $app,$conf;
 		
 		if($conf['demo_mode'] == true) $app->error("Mail sending disabled in demo mode.");
@@ -53,7 +53,9 @@ class functions {
 				unset($path_parts);
 			}
 
-			$header = "Return-Path: $form\nFrom: $from\nReply-To: $from\n";
+			$header = "Return-Path: $from\nFrom: $from\nReply-To: $from\n";
+			if($cc != '') $header .= "Cc: $cc\n";
+			if($bcc != '') $header .= "Bcc: $bcc\n";
 			$header .= "MIME-Version: 1.0\n";
 			$header .= "Content-Type: multipart/mixed; boundary=$uid\n";
 
@@ -74,6 +76,8 @@ class functions {
 			mail($to, $subject, "", $header);
 		} else {
 			$header = "From: $from\nReply-To: $from\n";
+			if($cc != '') $header .= "Cc: $cc\n";
+			if($bcc != '') $header .= "Bcc: $bcc\n";
 			$header .= "Content-Type: text/plain;\n\tcharset=\"UTF-8\"\n";
 			$header .= "Content-Transfer-Encoding: 8bit\n\n";
 			$subject      = "=?utf-8?B?".base64_encode($subject)."?=";
-- 
GitLab