如何在magento中创建重置密码链接,然后将邮件发送给相应的客户。我已经参考了这个链接:
1)http://stackoverflow.com/questions/19034753/magento-customer-password-reset-email
但我不知道该代码内部会发生什么。请解决此问题。我想手动(以编程方式)完成
答案 0 :(得分:11)
我认为这样的事情应该有效:
/** @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);
}
}