4

I want to send a "set password" email to users.

I made a script where there is an option like "user register by email id" and other details. We review their detail and activate them. When the user is activated, a mail is sent to them to set the password for their account.

I'm stuck with part of sending set password email.

2

Take a look at Magento Migrate customers with no password.

$customer = Mage::getModel('customer/customer');

$password = '123456';
$email = 'testuser@test.com';

$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($email);

if($customer->getId()) { // if customer does not already exists, by email

    $newPassword = $customer->generatePassword(); // generate a new password
    $customer->changePassword($newPassword); // set it
    $customer->save();    
}

Assuming that you want to use the default magento password template then take a look at app/code/core/Mage/Adminhtml/controllers/CustomerController.php

// Send welcome email
if ($customer->getWebsiteId() && (isset($data['account']['sendemail']) || $sendPassToEmail)) {
    $storeId = $customer->getSendemailStoreId();
    if ($isNewCustomer) {
        $customer->sendNewAccountEmail('registered', '', $storeId);
    } elseif ((!$customer->getConfirmation())) {
    // Confirm not confirmed customer
            $customer->sendNewAccountEmail('confirmed', '', $storeId);
    }
}
  • no you did not get it i want to send email (a link) user opens link and creates password there – mcoder Oct 12 '14 at 17:41
  • Is your question how to create an send email with template in magento? – Renon Stewart Oct 12 '14 at 20:51
  • yeah but it will be reset password mail – mcoder Oct 13 '14 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.