I am using WordPress 3.1.3
I am getting following notices when I use wp_mail with cc and bcc headers.
Notice: Undefined variable: cc in /var/www/mysite.info/htdocs/wordpress/wp-includes/pluggable.php on line 349
Notice: Undefined variable: bcc in /var/www/mysite.info/htdocs/wordpress/wp-includes/pluggable.php on line 352
This is how I am setting email headers
$email_headers = "From: ".$from_field_value.PHP_EOL;
$email_headers .= "Reply-To: ".$from_field_value.PHP_EOL;
$email_headers .= "CC: mail@gmail.com".PHP_EOL;
$email_headers .= "BCC: mail@gmail.com".PHP_EOL;
if (wp_mail($email_to, $email_subject, $email_body, $email_headers)) {
// Other process
}
If you look at the line the notice is being issued:
and
What its trying to do is merge a blank array that hasn’t been set with an array created by your headers.
The notice can be ignored. After all its just a notice.
As this function is pluggable you can copy the function and place in a plugin file and correct the code. That way you are not editing core files. See pluggable functions:
http://codex.wordpress.org/Pluggable_Functions
I would modify the code as follows:
Maybe this should be reported to wordpress core dev team?
UPDATE:
Above will be fixed in WP3.2 http://core.trac.wordpress.org/changeset/18006