I have added all customers with the same password now I want to send the forgot password link programmatically to all customers.

I have tried below by creating the file in root. Using below code i can send forgot password mail to the customer but when customer click on the password it display a blank screen with "" URL

It redirect to same link For Eg. I have created test.php file and put below code. when i execute test.php file at that customer get reset password mail but when customer click on reset password mail they get link like "**test.php**/customer/account/changeforgotten/" instead of "" "

require_once('app/Mage.php'); //Path to Magento
$yourCustomerEmail="[email protected]";
$customer = Mage::getModel('customer/customer')
if ($customer->getId()) {
    try {
        $newResetPasswordLinkToken =  Mage::helper('customer')->generateResetPasswordLinkToken();
    } catch (Exception $exception) {

In This email functionality is working perfect

  • I think this is token issue. Oct 25, 2018 at 8:28
  • @SunnyRahevar it redirect to same link.
    – Jaimin
    Oct 25, 2018 at 8:43
  • How to remove test.php from that button. Any suggestion to sort it out that issue.
    – Nikul
    May 24, 2019 at 10:11

1 Answer 1


You can add this code in index file with a condition like below

if($_GET['reset'] == 1 && isset($_GET['reset']))
.... Your Code for Email .....

Now run index.php with Like http://YOURSTORE_URL/index.php?reset=1

  • Nice One @Divyarajsinh ;)
    – Jaimin
    Oct 25, 2018 at 9:07
  • You are genius man!!! Oct 25, 2018 at 9:07
  • @Divyarajsinh I have Put above code as per mention into index file but site is broken. Can you tell me how it works?
    – Nikul
    May 24, 2019 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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