Skip to main content

Send rest password link email to customer programmatically in magento

How to Send rest password link email to customer programmatically in magento?

Usually you need to load the customer first, then call the function on customer logic like this 

 

<?php
$customer_email = "[email protected]";
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
$customer ->loadByEmail($customer_email);

if ($customer->getId()) {
    try {
        $newResetPasswordLinkToken =  Mage::helper('customer')->generateResetPasswordLinkToken();
        $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
        $customer->sendPasswordResetConfirmationEmail();
    } catch (Exception $exception) {
        Mage::log($exception);
    }
}
?>