I have a Magento 2.2.1 Running on a Amazon Lightsail VPS (the Bitnami Magento stack).

It has been working just fine, an previously I would get a "Password reset information" e-mail from the system whenever I tried to change the password of a user.

Now, however, if I try to set a new password, the page just reloads with an "Unable to send mail" error message being displayed at the top.

enter image description here

I'm using the SMTP App for Magento 2 plugin to handle mail, and when I go to Stores > Configuration > Advanced > System and test the mail set-up I successfully receive an e-mail from the system.

I have also verified that the e-mail addresses of the user accounts I am trying to reset the password for are valid.

UPDATE, I'm pasting the code from my _sendMail() function below.

    public function _sendMail()
    set_error_handler(array($this, '_handleMailErrors'));
    $result = mail(

    if ($this->_errstr !== null || !$result) {
         * @see Zend_Mail_Transport_Exception
        #require_once 'Zend/Mail/Transport/Exception.php';
        throw new Zend_Mail_Transport_Exception('Unable to send mail. ' . $this->_errstr);

If you look at the code, the error is thrown in \Zend_Mail_Transport_Sendmail, in the _sendMail() method, apparently it is still trying to send through the PHP mail() functionality.

  • Thanks for the pointer, but where exactly do I find that piece of code? I have been looking for it in the app/code/ folder under htdocs but I have not been able to locate it. – lundzern Nov 17 '17 at 11:15
  • True, it's in /vendor/magento/zendframework1/library/Zend/Mail/Transport/Sendmail.php – Niels Nov 17 '17 at 11:16
  • Excellent, I found the piece of code, and I pasted the _sendMail() method in the original post. Do you see any obvious errors there? – lundzern Nov 17 '17 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.