From a5037b82d574387438bbfe8359bba44304a32a54 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 15 Jul 2008 05:06:16 +0000 Subject: [PATCH] MINOR fixed PHP notice when Email::send_all_emails_to() and Email::cc_all_emails_to() are used at the same time git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@58023 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- email/Email.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/email/Email.php b/email/Email.php index b8fadf5c0..19a7725b1 100755 --- a/email/Email.php +++ b/email/Email.php @@ -321,12 +321,19 @@ class Email extends ViewableData { } if(self::$cc_all_emails_to) { - if(trim($headers['Cc'])) $headers['Cc'] .= ', '; - $headers['Cc'] .= self::$cc_all_emails_to; + if(!empty($headers['Cc']) && trim($headers['Cc'])) { + $headers['Cc'] .= ', ' . self::$cc_all_emails_to; + } else { + $headers['Cc'] = self::$cc_all_emails_to; + } } + if(self::$bcc_all_emails_to) { - if(trim($headers['Bcc'])) $headers['Bcc'] .= ', '; - $headers['Bcc'] .= self::$bcc_all_emails_to; + if(!empty($headers['Bcc']) && trim($headers['Bcc'])) { + $headers['Bcc'] .= ', ' . self::$bcc_all_emails_to; + } else { + $headers['Cc'] = self::$bcc_all_emails_to; + } } return self::mailer()->sendHTML($to, $this->from, $subject, $this->body, $this->attachments, $headers, $this->plaintext_body);