the email could not be sent. possible reason: your host may have disabled the mail() function.
- WordPress is built on PHP and it uses PHP
mail()to send emails in different situations.
- It is also referred as
wp_mail()function or just
mail()function however, uses a program called
sendmailto work or send email using
your host may have disabled the mail() function.
- To find out if PHP
mail()function is disabled in
php.inifile, you need to first open the
php.inifile is often located in a folder under
possible reason: your host may have disabled the mail() function.
There are two conditions.
$messagehave to be true (not an empty string, not false, not null, etc). And
wp_mail() shouldn’t return false.
if ( $message && !wp_mail($user_email, $title, $message) )
You can easily find the path of PHP.ini file by uploading a simple php file with following script to your hosting server.
<?php phpinfo(); ?>
wp_mail() function to send email which need PHPMailer class which used php mailer stored in /usr/sbin/sendmail.
Use this simple php function first to check php mail
<?php $to = "firstname.lastname@example.org"; $subject = "Test Email Function"; $txt = "Hello world!"; $headers = "From: email@example.com" . "\r\n" . "CC: firstname.lastname@example.org"; mail($to,$subject,$txt,$headers); ?>
If this is not working then you need to install php mailer. Use this command to install php mail on Ubuntu server.
sudo apt-get install sendmail
Then check word-press email functions.