I am breaking my head from last 1 hour but not getting any idea that what’s going wrong with my code…
I am developing my own plugin and I am using wp_mail()
function for sending mail in that but it’s not sending mail it seems.
I tried to use PHP Mailer which is working fine but I want to use wp_mail()
.. this is my code..
$from = "abc@gmail.com";
$headers[] = "From:" . $from;
$send = wp_mail("myemail@gmail.com", "hiii", "hiiii",$headers);
if($send) {
echo "send";
return false;
} else {
echo $send;
return true;
}
Can any body help me to figure out my mistake… I am testing it on my server only…
Thanks in advance.
2 Answers
Since PHP Mailer is working fine do you have the same credentials setup for wp_mail? If you’re using an authenticated SMTP for PHP Mailer then you’ll possibly need a plugin to get the authentication into wp_mail. There are a few different ones that all work but one is https://wordpress.org/plugins/wp-mail-smtp/ for example.