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
This commit is contained in:
Sean Harvey 2008-07-15 05:06:16 +00:00
parent 9bf204d8f1
commit a5037b82d5

View File

@ -321,12 +321,19 @@ class Email extends ViewableData {
} }
if(self::$cc_all_emails_to) { if(self::$cc_all_emails_to) {
if(trim($headers['Cc'])) $headers['Cc'] .= ', '; if(!empty($headers['Cc']) && trim($headers['Cc'])) {
$headers['Cc'] .= self::$cc_all_emails_to; $headers['Cc'] .= ', ' . self::$cc_all_emails_to;
} else {
$headers['Cc'] = self::$cc_all_emails_to;
}
} }
if(self::$bcc_all_emails_to) { if(self::$bcc_all_emails_to) {
if(trim($headers['Bcc'])) $headers['Bcc'] .= ', '; if(!empty($headers['Bcc']) && trim($headers['Bcc'])) {
$headers['Bcc'] .= self::$bcc_all_emails_to; $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); return self::mailer()->sendHTML($to, $this->from, $subject, $this->body, $this->attachments, $headers, $this->plaintext_body);