The wp_mail
function doesn't work after updating WordPress to version 4.6.
My code is:
$headers = 'From: ' . $this->from_name . ' <' . $this->from_email .'>' . "\r\n";
wp_mail( $service->getEmail(), $this->admin_daily_subject, $admin_daily_message, $headers );
It worked perfectly before the update. Also, I've noticed that sending emails doesn't work in Contact Form 7. Any ideas? Thanks in advance.
UPDATE
As I did not find the solution, I replaced wp_mail
with mail function and added some headers:
$headers = 'From: ' . $this->from_name . ' <'.$this->from_email.'>' . "\r\n" .
'Reply-To: '.$this->from_email . "\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
"Content-Type: text/html; charset=UTF-8";
mail( $service->getEmail(), $this->admin_daily_subject, $admin_daily_message, $headers );
With this update it works. I hope there will be some updates of wp codex about using wp_mail()
with 4.6 or somebody will find a solutions.
UPDATE 2
It looks like I am not the only one that is facing this issue:
wp_mail
on changes in 4.6 you will see that there are two changes. Maybe this will help somehowwp_mail()
, can you post the output of thephpmailer
debug?global $phpmailer; echo $phpmailer->ErrorInfo
wp_mail
with previous revision, it can be find here: https://core.trac.wordpress.org/changeset/38058/