0

Anybody know where magento 2 in adminhtml customer creation, get email template, put it in transport builder, and send mail to customer with cunfirmation link.

1

Check the following class:

vendor/magento/module-customer/Model/AccountManagement.php

protected function sendEmailConfirmation(CustomerInterface $customer, $redirectUrl)
{
    try {
        $hash = $this->customerRegistry->retrieveSecureData($customer->getId())->getPasswordHash();
        $templateType = self::NEW_ACCOUNT_EMAIL_REGISTERED;
        if ($this->isConfirmationRequired($customer) && $hash != '') {
            $templateType = self::NEW_ACCOUNT_EMAIL_CONFIRMATION;
        } elseif ($hash == '') {
            $templateType = self::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD;
        }
        $this->getEmailNotification()->newAccount($customer, $templateType, $redirectUrl, $customer->getStoreId());
        $customer->setConfirmation(null);
    } catch (MailException $e) {
        // If we are not able to send a new account email, this should be ignored
        $this->logger->critical($e);
    } catch (\UnexpectedValueException $e) {
        $this->logger->error($e);
    }
}

The following line is sent email template for resetting the password:

$templateType = self::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD;

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.