• Register
0 votes

Problem :

Getting following wordpress error while tring to send the email
the email could not be sent. possible reason: your host may have disabled the mail() function.
6.9k points
reopened by

Please log in or register to answer this question.

2 Answers

0 votes
Best answer

Solution :

Go to -Manage Registered Email-Ids for Sending Mails via Scripts or Wordpress

  1. Firstly you need to Login to your Cpanel.
  2. Then go to Email Section > then Click Registered Email IDs.
  3. then add domain (wordpress@yourdomain.com) or where your wordpress hosted (wordpress@blog.yourdomain.com) . then submit , it will take few minute to activate can wait 15minute to 1 hour depending to your hosting provider, then it will work.
38.6k points
selected by
0 votes



 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. $messagehave 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:

 * 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      = 'your-email-adress@some-domain.tld';
    $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.

31.7k points

Related questions

0 votes
1 answer 30 views
Problem: Can someone please help fix this > The e-mail could not be sent. possible reason: your host may have disabled the mail() function.
asked Apr 22 ummeshani 10.8k points
0 votes
1 answer 7 views
Problem: Is there a way to fix this : Your host may have disabled the mail function?
asked May 27 Rada Gracelynn 104k points
1 vote
1 answer 31 views
Problem: How to fix this erro:the activity must be exported or contain an intent-filter. your host may have disabled the mail() function.
asked Mar 3 Muneeb Saadii 130k points
0 votes
1 answer 11 views
Problem: Mail has been disabled for security reasons
asked Jul 11 nila 121k points
0 votes
1 answer 19 views
Problem: Can anyone help me out please : Mail:could not instantiate mail function?
asked Jun 1 Irenka Kiri 85.5k points
1 vote
1 answer 22 views
Problem: Getting the following error. Mailer error could not instantiate mail function.
asked Mar 25 PkGuy 25.9k points
0 votes
1 answer 119 views
Problem Hi Kodlogs, How am having following error while sending mails using PHP: mailer error: could not instantiate mail function Need help fixing please
asked Nov 3, 2020 hashq 1.1k points
0 votes
0 answers 31 views
Problem: Is there some way to solve this problem: Javax.mail.messagingexception: could not connect to smtp host: smtp.gmail.com, port: 587;?
asked Jun 12 Shima 126k points
0 votes
1 answer 6 views
Problem: I'm looking for a solution : Message could not be sent mailer error smtp connect failed.
asked Jun 23 Florina Gulnar 106k points
0 votes
1 answer 32 views
Problem: What should I do if I can't find a solution anywhere : Message could not be sent. mailer error: smtp error: could not authenticate?
asked Jun 15 Nahil 128k points