diff --git a/framework/core/src/Mail/Job/SendInformationalEmailJob.php b/framework/core/src/Mail/Job/SendInformationalEmailJob.php index b1c9afb3d0..ea1996dffd 100644 --- a/framework/core/src/Mail/Job/SendInformationalEmailJob.php +++ b/framework/core/src/Mail/Job/SendInformationalEmailJob.php @@ -17,13 +17,14 @@ class SendInformationalEmailJob extends AbstractJob { public function __construct( private readonly string $email, + private readonly string $displayName, private readonly string $subject, private readonly string $body, private readonly string $forumTitle, private readonly ?string $bodyTitle = null, protected array $views = [ - 'plain' => 'flarum.forum::email.information.plain.base', - 'html' => 'flarum.forum::email.information.html.base' + 'plain' => 'flarum.forum::email.plain.information.base', + 'html' => 'flarum.forum::email.html.information.base' ] ) { } @@ -34,10 +35,11 @@ public function handle(Mailer $mailer): void $infoContent = $this->body; $userEmail = $this->email; $title = $this->bodyTitle; + $username = $this->displayName; $mailer->send( $this->views, - compact('forumTitle', 'infoContent', 'userEmail', 'title'), + compact('forumTitle', 'infoContent', 'userEmail', 'title', 'username'), function (Message $message) { $message->to($this->email); $message->subject($this->subject); diff --git a/framework/core/src/User/AccountActivationMailerTrait.php b/framework/core/src/User/AccountActivationMailerTrait.php index a43e4bf30e..dc0f9aa6b8 100644 --- a/framework/core/src/User/AccountActivationMailerTrait.php +++ b/framework/core/src/User/AccountActivationMailerTrait.php @@ -39,6 +39,6 @@ protected function sendConfirmationEmail(User $user, array $data): void $body = $this->translator->trans('core.email.activate_account.body', $data); $subject = $this->translator->trans('core.email.activate_account.subject'); - $this->queue->push(new SendInformationalEmailJob($user->email, $subject, $body, Arr::get($data, 'forum'))); + $this->queue->push(new SendInformationalEmailJob(email: $user->email, subject: $subject, body: $body, forumTitle: Arr::get($data, 'forum'), displayName: Arr::get($data, 'username'))); } } diff --git a/framework/core/src/User/EmailConfirmationMailer.php b/framework/core/src/User/EmailConfirmationMailer.php index 28b6fc990a..1cee65bea4 100644 --- a/framework/core/src/User/EmailConfirmationMailer.php +++ b/framework/core/src/User/EmailConfirmationMailer.php @@ -35,7 +35,7 @@ public function handle(EmailChangeRequested $event): void $body = $this->translator->trans('core.email.confirm_email.body', $data); $subject = $this->translator->trans('core.email.confirm_email.subject'); - $this->queue->push(new SendInformationalEmailJob($email, $subject, $body, Arr::get($data, 'forum'))); + $this->queue->push(new SendInformationalEmailJob(email: $email, subject:$subject, body: $body, forumTitle: Arr::get($data, 'forum'), displayName: Arr::get($data, 'username'))); } protected function generateToken(User $user, string $email): EmailToken diff --git a/framework/core/src/User/Job/RequestPasswordResetJob.php b/framework/core/src/User/Job/RequestPasswordResetJob.php index 68abf8369e..d58241b81c 100644 --- a/framework/core/src/User/Job/RequestPasswordResetJob.php +++ b/framework/core/src/User/Job/RequestPasswordResetJob.php @@ -51,6 +51,13 @@ public function handle( $body = $translator->trans('core.email.reset_password.body', $data); $subject = $translator->trans('core.email.reset_password.subject'); - $queue->push(new SendInformationalEmailJob($user->email, $subject, $body, Arr::get($data, 'forum'))); + $queue->push(new SendInformationalEmailJob( + email: $user->email, + subject: $subject, + body: $body, + forumTitle: Arr::get($data, 'forum'), + displayName: Arr::get($data, 'username'), + bodyTitle: $subject + )); } }