i want to create reset password link and mail it to customer using php code what have i to write to do this could not figure out ?..

i wrote below code in my custom page but it not works:


$customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email);
$newResetPasswordLinkToken =  $customer->_getHelper('customer')->generateResetPasswordLinkToken();
echo $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
  • Where are you running this code from? Oct 13 '14 at 18:54
  • i have made custom layout page for that
    – mcoder
    Oct 14 '14 at 1:19

To send a rest link by email


$customer = Mage::getModel('customer/customer')
  • no i just want to create reset password link after that magento will take care : i write below code in custom page but it is not working $email='abc@gmail.com'; $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email); $newResetPasswordLinkToken = $customer->_getHelper('customer')->generateResetPasswordLinkToken(); echo $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken); $customer->sendPasswordResetConfirmationEmail();
    – mcoder
    Oct 13 '14 at 18:47
  • thanks its working, but how can i get password reset link like abc.com/customer/account/resetpassword/… or i want to use different email template is that possible
    – mcoder
    Oct 14 '14 at 1:25
  • Not sure I understand your question, can you explain what your tying to accomplish? Oct 14 '14 at 13:26
  • but what if want to reset password of one of admins , how can i use above code to work ?..
    – mcoder
    Oct 14 '14 at 23:17
  • Take a look at orgotpasswordAction() in app/code/core/Mage/Adminhtml/controllers/IndexController.php Oct 15 '14 at 13:18

could you explain your use-case in more detail and where you put your code? Otherwise it is hard to help.


  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation.
    – Marius
    Oct 13 '14 at 20:23
  • I was actually asking for more information, it is not clear what the the question is about.
    – RobM84
    Oct 13 '14 at 20:31
  • The answers section is reserved for answers. Do not ask questions in the answer section. Take a tour of SE to see how things should work in here.
    – Marius
    Oct 13 '14 at 20:38
  • "Use comments to ask for more information or clarify a question or answer." => got it "You can always comment on your own questions and answers. Once you earn 50 reputation, you can comment on anybody's post." => So I couldn't ask, my reputation is 29 :( So it's better to wait and not ask for more information?
    – RobM84
    Oct 13 '14 at 20:49

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.