I’m using WP 3.3.1
I am trying to add BCC onto the headers of an email I’m sending out, but the BCC is not being added.
public $from = "sender@example.com";
public $replyTo = "sender@example.com";
public $bcc = "bccaddress@example.com";
$headers['From'] = "From: ".$this->from;
$headers['Reply-To'] = "Reply-To: ".$this->replyTo;
$headers['Bcc'] = "Bcc: ".$this->bcc;
wp_mail("example@example.com", "My Subject Line" , $html, $headers);
I’ve looked at this article, which says the problem was suppose to be fixed in WP 3.2…but for me, it’s still not working.
I am using a local SMTP server application called Papercut to monitor the emails that are being sent.
You could try to debug the output like this:
The code in your question is correct, the problem is with your local SMTP application. If you are using a local SMTP server (e.x. Papercut), it only displays the headers that a receiver would see. Since BCC addresses are hidden, you will not see them. So to check to see if BCC addresses are being attached, you can use the function I’ve listed above which will spit out the mail output.