私たちの Magento アプリケーションでは、トランザクション メール テンプレートを使用して、パスワードのリセット メールを送信しました。
パスワードを忘れた場合のウィンドウでボタンをクリックするsubmit
と、電子メール テンプレートに基づいて 1 つの電子メールが送信されます...
以下はコードですAccountcontroller
$newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
/*$customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
$customer->sendPasswordResetConfirmationEmail();*/
$templateId = "Reset_password_user";
$flname = $customer->getFirstname().' '.$customer->getLastname();
$emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateId);
$vars = array('name' => ucwords($flname), 'userid' => $customer->getId(), 'tocken' => $newResetPasswordLinkToken);
$emailTemplate->getProcessedTemplate($vars);
$storeId = Mage::app()->getStore()->getStoreId();
$emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $storeId));
$emailTemplate->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', $storeId));
$emailTemplate->send($email,ucwords($flname), $vars);
メール内容は以下になります。
There was recently a request to change the password for your account.
If you requested this password change, please click on the following link to reset your password: http://mywebsite.com/index.php/customer/account/resetpassword/?id=3607&token=f74609505166ef132345ba78539e6b90
If clicking the link does not work, please copy and paste the URL into your browser instead.
If you did not make this request, you can ignore this message and your password will remain the same.
では、ここで何が問題なのですか?
メールのリンクをクリックすると、パスワードを忘れた場合のリンクが読み込まれ、次のようなエラー メッセージが表示されます。
Your password reset link has expired.