Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create and send email to customer reset password link programmatically in magento

Tags:

php

reset

magento

How to create a reset password link in magento and then send the mail to the corresponding customer.I have referred this link:

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

But i don't know what is going inside that code.So kindly answer to solve this.I want to done it manually(programmatically)

like image 677
PHP dev Avatar asked Jan 13 '15 10:01

PHP dev


1 Answers

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);
            }
        }
like image 99
Javier C. H. Avatar answered Oct 14 '22 13:10

Javier C. H.