I'm working on shop where the customers will be imported by CSV, new customers will have NO password (password_hash = "").
The administrator will have to activate the new customers using the backend.
If a customer becomes activated, a random password should be generated and it should be included in the mail.
What I need to know is just where I find the code where the email will be sent.
The code of the email template is "customer_create_account_email_template".
It's not the sendNewAccountEmail()
method in app/code/core/Customer/Model/Customer.php
and it's not either successProcessRegistration()
in app/code/core/Customer/controllers/AccountController.php
.
Best Answer
You didn't specify a Magento version so I'll explain it based on the current version CE 1.9.1.0. If you are sure that
sendNewAccountEmail()
isn't used I'd suggest you have a look atsendPasswordReminderEmail()
inapp/code/core/Mage/Customer/Model/Customer.php
.Here is an explanation:
Mage_Adminhtml_CustomerController::saveAction()
is triggered.The password and e-mail logic starts in the code block around line 305:
Here, the password for a new customer would be generated.
Next, the mails are sent:
Normally, the mail template
customer_create_account_email_template
is used when a new user registered and confirmation is not required (i.e.$customer->sendNewAccountEmail('registered', '', $storeId);
in the snippet above).As you imported the customer before and just re-save it with a auto-generated password, the second part of the code should apply and the mail should be sent here:
This method
sendPasswordReminderEmail()
which can be found inapp/code/core/Mage/Customer/Model/Customer.php
uses the mail template configured as the "Remind E-Mail Template".