【问题标题】:Create and send email to customer reset password link programmatically in magento在 magento 中以编程方式创建并向客户发送电子邮件重置密码链接
【发布时间】:2015-03-11 06:59:48
【问题描述】:

如何在magento中创建重置密码链接,然后发送邮件给对应的客户。我参考了这个链接:

    1)http://stackoverflow.com/questions/19034753/magento-customer-password-reset-email

但我不知道该代码中发生了什么。所以请回答解决这个问题。我想手动(以编程方式)完成

【问题讨论】:

    标签: php magento reset


    【解决方案1】:

    我认为这样的事情应该可行:

            /** @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);
                }
            }
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-16
    • 1970-01-01
    • 1970-01-01
    • 2013-02-17
    • 2016-04-04
    • 2013-10-07
    • 2015-11-26
    相关资源
    最近更新 更多