I am new in wordpress. I am sending mail via wp-mail function locally I have install east wp-mail plugin for smtp.
include("wp-mail.php");
$to = 'test@gmail.com';
$subject = 'Apple Computer';
$message = 'Steve, I think this computer thing might really take off.';
wp_mail( $to, $subject, $message );
But I am getting error liike :
Slow down cowboy, no need to check for new mails so often!
Please guide me….
Do i need to change in any file or install any plugin ???
wp_mail
works similar to PHP’s functionmail
. You can read more about it here. PHPmail
function needs access tosendmail
binary, as stated in docs, you shouldn’t have this configured in localhost, that’s why it fails to send emails.In order to send emails when testing your site in localhost you should configure SMTP to send emails.
There’s a pretty good plugin called WP Mail SMTP, you can install it here.
It overrides the
wp_mail
function and enables you to send emails using the Gmail SMTP server, for instance. You can use any SMTP server you want.If you not want to use any plugin to setup your smtp you can do it easy with code . WordPress have their own hook to setup smtp.
Here is the code. Simply by adding your Host, Username and Password. You can send email from your local machine.
You can learn more about it on WordPress Codex