Step by step: First find the file where the error message appear. I use Notepad++ and the CTRL + F command to search in files. It is a good idea to search only the first few words of the error message, because some error messages are combined of different messages.
Your error message appear in wp-login.php
and holy luck, only there. So let's have a look why this error could occur.
if ( $message && !wp_mail($user_email, $title, $message) )
There are two conditions. $message
have to be true (not an empty string, not false, not null, etc). And wp_mail()
shouldn't return false.
One line above, there is a filter $message = apply_filters('retrieve_password_message', $message, $key);
, so it is possible that a plugin (or theme) use this filter and returns a value that is not true (empty string, false, null, etc.).
But it is much easier to check if wp_mail()
is working or not. Write a small plugin to send a test mail to yourself:
<?php
/**
* Plugin Name: Stackexchange Testplugin
* Plugin URI: http://yoda.neun12.de
* Description: Send me a test email
* Version: 0.1
* Author: Ralf Albert
* Author URI: http://yoda.neun12.de
* Text Domain:
* Domain Path:
* Network:
* License: GPLv3
*/
namespace WordPressStackexchange;
add_action( 'init', __NAMESPACE__ . '\plugin_init' );
function plugin_init(){
$to = '[email protected]';
$subject = 'Testemail';
$message = 'FooBarBaz Testmail is working';
wp_mail( $to, $subject, $message );
}
(This is PHP5.3 code. If you are running PHP5.2, remove the namespace things)
The plugin should send a testmail immediately after activation. If not, calling some backend pages (e.g. dashboard) should do it.
If the testmail does not arrive, then you probably have an issue with wp_mail()
. So turn on debugging:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors',1 );
Put this code into your wp-config.php
and retry sending yourself a testmail. Now you should get some error messages and they also should be logged into wp-content/debug.log
(The debug log can grow very large if there are more errors caused by plugins and/or themes).
At this point, you got good informations if wp_mail()
fails and if so, why. If wp_mail()
work correctly and the testmail arrived, go back to top and find out why $message
is not true.
If you have issues with wp_mail()
, so keep in mind that wp_mail()
does not use PHPs mail()
function. WordPress use a PHP class (PHPMailer). Maybe you just need a plugin to use SMTP instead of sendmail. Or the problem is located at another place. We don't know. You have to investigate.