From cbcec379b35d4fd602130e8c2fa1c5fc1a85625f Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Thu, 26 Sep 2013 12:50:41 -0700 Subject: [PATCH] Fix cc/bcc address merged with to address for Mail_mail class --- CRM/Utils/Mail.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index 108786c9e5..7306769739 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -163,19 +163,21 @@ class CRM_Utils_Mail { $headers = &$msg->headers($headers); $to = array($params['toEmail']); - - //get emails from headers, since these are - //combination of name and email addresses. - if (CRM_Utils_Array::value('Cc', $headers)) { - $to[] = CRM_Utils_Array::value('Cc', $headers); - } - if (CRM_Utils_Array::value('Bcc', $headers)) { - $to[] = CRM_Utils_Array::value('Bcc', $headers); - unset($headers['Bcc']); + $result = null; + $mailer =& CRM_Core_Config::getMailer( ); + + // Mail_smtp and Mail_sendmail mailers require Bcc anc Cc emails + // be included in both $to and $headers['Cc', 'Bcc'] + if (get_class($mailer) != "Mail_mail") { + //get emails from headers, since these are + //combination of name and email addresses. + if ( CRM_Utils_Array::value( 'Cc', $headers ) ) { + $to[] = CRM_Utils_Array::value( 'Cc', $headers ); + } + if ( CRM_Utils_Array::value( 'Bcc', $headers ) ) { + $to[] = CRM_Utils_Array::value( 'Bcc', $headers ); + } } - - $result = NULL; - $mailer = CRM_Core_Config::getMailer(); if (is_object($mailer)) { CRM_Core_Error::ignoreException(); $result = $mailer->send($to, $headers, $message); -- 2.25.1