1

I want add bcc for forgot password email in magento 2.

When i checked the code - \vendor\magento\module-customer\Controller\Account\ForgotPasswordPost.php in execute method we have this

try {
       $this->customerAccountManagement->initiatePasswordReset(
                    $email,
                    AccountManagement::EMAIL_RESET
                );
} 

How can i add Bcc for this mail.

Thanks!

1 Answer 1

1

Please check this function sendEmailTemplate on vendor/magento/module-customer/Model/EmailNotification.php ,and try to override and add BCC email in $bccEmail like below.

$transport = $this->transportBuilder->setTemplateIdentifier($templateId)
    ->setTemplateOptions(['area' => 'frontend', 'store' => $storeId])
    ->setTemplateVars($templateParams)
    ->setFrom($from)
    ->addTo($email, $this->customerViewHelper->getCustomerName($customer))
    ->addBcc([$bccEmail])
    ->getTransport();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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