Handle cc and bcc. Props MattyRob. fixes #6899

git-svn-id: https://develop.svn.wordpress.org/trunk@8098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-06-16 20:02:10 +00:00
parent 0f60672bdd
commit f6ee577705
1 changed files with 17 additions and 1 deletions

View File

@ -315,6 +315,10 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
} else {
$content_type = trim( $content );
}
} elseif ( 'cc' == strtolower($name) ) {
$cc = explode(",", $content);
} elseif ( 'bcc' == strtolower($name) ) {
$bcc = explode(",", $content);
} else {
// Add it to our grand headers array
$headers[trim( $name )] = trim( $content );
@ -360,6 +364,18 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
$phpmailer->Subject = $subject;
$phpmailer->Body = $message;
// Add any CC and BCC recipients
if ( !empty($cc) ) {
foreach ($cc as $recipient) {
$phpmailer->AddCc( trim($recipient) );
}
}
if ( !empty($bcc) ) {
foreach ($bcc as $recipient) {
$phpmailer->AddBcc( trim($recipient) );
}
}
// Set to use PHP's mail()
$phpmailer->IsMail();
@ -1532,4 +1548,4 @@ function wp_text_diff( $left_string, $right_string, $args = null ) {
}
endif;
?>
?>