【发布时间】:2015-03-11 06:59:48
【问题描述】:
如何在magento中创建重置密码链接,然后发送邮件给对应的客户。我参考了这个链接:
1)http://stackoverflow.com/questions/19034753/magento-customer-password-reset-email
但我不知道该代码中发生了什么。所以请回答解决这个问题。我想手动(以编程方式)完成
【问题讨论】:
如何在magento中创建重置密码链接,然后发送邮件给对应的客户。我参考了这个链接:
1)http://stackoverflow.com/questions/19034753/magento-customer-password-reset-email
但我不知道该代码中发生了什么。所以请回答解决这个问题。我想手动(以编程方式)完成
【问题讨论】:
我认为这样的事情应该可行:
/** @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);
}
}
【讨论】: