7 declare(strict_types=1);
33 private $transportBuilder;
43 private $deployConfig;
48 private $storeManager;
62 $this->transportBuilder = $transportBuilder;
79 private function sendNotification(
80 string $templateConfigId,
85 $transport = $this->transportBuilder
86 ->setTemplateIdentifier($this->config->getValue($templateConfigId))
87 ->setTemplateModel(BackendTemplate::class)
88 ->setTemplateOptions([
92 ->setTemplateVars($templateVars)
94 $this->config->getValue(
'admin/emails/forgot_email_identity')
96 ->addTo($toEmail, $toName)
98 $transport->sendMessage();
107 $this->sendNotification(
108 'admin/emails/forgot_email_template',
111 'store' => $this->storeManager->getStore(
116 $user->getFirstName().
' '.
$user->getLastName()
120 __($exception->getMessage()),
132 $generalEmail = $this->config->getValue(
133 'trans_email/ident_general/email' 136 $toEmails[] = $generalEmail;
138 if ($adminEmail = $this->deployConfig->get(
'user_admin_email')) {
139 $toEmails[] = $adminEmail;
143 foreach ($toEmails as $toEmail) {
144 $this->sendNotification(
145 'admin/emails/new_user_notification_template',
148 'store' => $this->storeManager->getStore(
153 __(
'Administrator')->getText()
158 __($exception->getMessage()),
175 $this->sendNotification(
176 'admin/emails/user_notification_template',
179 'store' => $this->storeManager->getStore(
182 'changes' => implode(
', ', $changed)
185 $user->getFirstName().
' '.
$user->getLastName()
189 __($exception->getMessage()),
sendCreated(UserInterface $user)
sendUpdated(UserInterface $user, array $changed)
sendForgotPassword(UserInterface $user)
__construct(TransportBuilder $transportBuilder, ConfigInterface $config, DeploymentConfig $deployConfig, StoreManagerInterface $storeManager)