How to send forgot password link programmatically

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
6
down vote

favorite












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 "http://127.0.0.1/magento1939/test.php/customer/account/resetpassword/?id=3&token=b3101c19f96551dea2e6f0a902b8c68f" 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 "http://127.0.0.1/magento1939/**test.php**/customer/account/changeforgotten/" instead of "http://127.0.0.1/magento1939/customer/account/changeforgotten/" "



<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app('default');
$yourCustomerEmail="bliss.jaimin@gmail.com";
$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);




In This email functionality is working perfect










share|improve this question























  • I think this is token issue.
    – Sunny Rahevar
    55 mins ago










  • @SunnyRahevar it redirect to same link.
    – Jaimin
    41 mins ago
















up vote
6
down vote

favorite












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 "http://127.0.0.1/magento1939/test.php/customer/account/resetpassword/?id=3&token=b3101c19f96551dea2e6f0a902b8c68f" 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 "http://127.0.0.1/magento1939/**test.php**/customer/account/changeforgotten/" instead of "http://127.0.0.1/magento1939/customer/account/changeforgotten/" "



<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app('default');
$yourCustomerEmail="bliss.jaimin@gmail.com";
$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);




In This email functionality is working perfect










share|improve this question























  • I think this is token issue.
    – Sunny Rahevar
    55 mins ago










  • @SunnyRahevar it redirect to same link.
    – Jaimin
    41 mins ago












up vote
6
down vote

favorite









up vote
6
down vote

favorite











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 "http://127.0.0.1/magento1939/test.php/customer/account/resetpassword/?id=3&token=b3101c19f96551dea2e6f0a902b8c68f" 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 "http://127.0.0.1/magento1939/**test.php**/customer/account/changeforgotten/" instead of "http://127.0.0.1/magento1939/customer/account/changeforgotten/" "



<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app('default');
$yourCustomerEmail="bliss.jaimin@gmail.com";
$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);




In This email functionality is working perfect










share|improve this question















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 "http://127.0.0.1/magento1939/test.php/customer/account/resetpassword/?id=3&token=b3101c19f96551dea2e6f0a902b8c68f" 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 "http://127.0.0.1/magento1939/**test.php**/customer/account/changeforgotten/" instead of "http://127.0.0.1/magento1939/customer/account/changeforgotten/" "



<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app('default');
$yourCustomerEmail="bliss.jaimin@gmail.com";
$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);




In This email functionality is working perfect







magento-1.9 forgot-password






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 14 mins ago









sv3n

9,08852248




9,08852248










asked 2 hours ago









Jaimin

910428




910428











  • I think this is token issue.
    – Sunny Rahevar
    55 mins ago










  • @SunnyRahevar it redirect to same link.
    – Jaimin
    41 mins ago
















  • I think this is token issue.
    – Sunny Rahevar
    55 mins ago










  • @SunnyRahevar it redirect to same link.
    – Jaimin
    41 mins ago















I think this is token issue.
– Sunny Rahevar
55 mins ago




I think this is token issue.
– Sunny Rahevar
55 mins ago












@SunnyRahevar it redirect to same link.
– Jaimin
41 mins ago




@SunnyRahevar it redirect to same link.
– Jaimin
41 mins ago










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










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






share|improve this answer






















  • Nice One @Divyarajsinh ;)
    – Jaimin
    16 mins ago











  • You are genius man!!!
    – Sunny Rahevar
    16 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f247824%2fhow-to-send-forgot-password-link-programmatically%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
3
down vote



accepted










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






share|improve this answer






















  • Nice One @Divyarajsinh ;)
    – Jaimin
    16 mins ago











  • You are genius man!!!
    – Sunny Rahevar
    16 mins ago














up vote
3
down vote



accepted










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






share|improve this answer






















  • Nice One @Divyarajsinh ;)
    – Jaimin
    16 mins ago











  • You are genius man!!!
    – Sunny Rahevar
    16 mins ago












up vote
3
down vote



accepted







up vote
3
down vote



accepted






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






share|improve this answer














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







share|improve this answer














share|improve this answer



share|improve this answer








edited 16 mins ago

























answered 17 mins ago









Divyarajsinh

1706




1706











  • Nice One @Divyarajsinh ;)
    – Jaimin
    16 mins ago











  • You are genius man!!!
    – Sunny Rahevar
    16 mins ago
















  • Nice One @Divyarajsinh ;)
    – Jaimin
    16 mins ago











  • You are genius man!!!
    – Sunny Rahevar
    16 mins ago















Nice One @Divyarajsinh ;)
– Jaimin
16 mins ago





Nice One @Divyarajsinh ;)
– Jaimin
16 mins ago













You are genius man!!!
– Sunny Rahevar
16 mins ago




You are genius man!!!
– Sunny Rahevar
16 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f247824%2fhow-to-send-forgot-password-link-programmatically%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery