Why do I get an error when I use the password reset option in my Lightsail WordPress website's login page?

2 minute read

On the Lost Password option of my Amazon Lightsail WordPress website log in page, I receive the error: "The email could not be sent. Your site may not be correctly configured to send email". I also can't send emails from my WordPress website using PHP mailer.

Short description

The PHP mail function uses the sendmail application to send emails. PHP mailer and the Forgot Password option depends on PHP mailer. It doesn't work in the following scenarios:

  • The sendmail application isn't installed in the instance.
  • The sendmail binary location isn't correctly configured in the PHP configuration file.


  1. Run the following command to verify that sendmail is installed. If you receive the error command not found, then sendmail isn't installed.

    sudo /usr/sbin/sendmail -q
  2. If sendmail isn't installed, then run the following command to install it:
    ****OS distributions such as Debian and Ubuntu

    sudo apt-get install sendmail

    ****OS distributions such as Amazon Linux 2 and CentOS

    sudo yum install sendmail
  3. Run the following command to configure PHP to use sendmail. This command modifies the PHP configuration file /opt/bitnami/php/etc/php.ini.

    sudo sed -i.$(date +%F_%R) '/sendmail_path/c\sendmail_path = "env -i /usr/sbin/sendmail -t -i"' /opt/bitnami/php/etc/php.ini
  4. Run the following command to restart PHP-FPM:

    sudo /opt/bitnami/ctlscript.sh restart php-fpm
  5. Use the password reset option on the log in page to verify that it now works.

AWS OFFICIALUpdated 5 months ago