Create and send email to client link reset password programmatically in purple

How to create a link for the reset password in magento, and then send an email to the appropriate client. I referenced this link:

    1)http://stackoverflow.com/questions/19034753/magento-customer-password-reset-email

But I do not know what is going on inside this code. So kindly answer that. I want to do it manually (programmatically)

+4
source share
1 answer

I think something like this should work:

        /** @var $customer Mage_Customer_Model_Customer */
        $customer = Mage::getModel('customer/customer')
            ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
            ->loadByEmail($yourCustomerEmail);
        if ($customer->getId()) {
            try {
                $newResetPasswordLinkToken =  Mage::helper('customer')->generateResetPasswordLinkToken();
                $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
                $customer->sendPasswordResetConfirmationEmail();
            } catch (Exception $exception) {
                Mage::log($exception);
            }
        }
+9
source

All Articles