diff --git a/src/Jobs/MailSendJob.php b/src/Jobs/MailSendJob.php index feabdeea3..1d9dc0d33 100644 --- a/src/Jobs/MailSendJob.php +++ b/src/Jobs/MailSendJob.php @@ -28,13 +28,13 @@ class MailSendJob extends Notification implements ShouldQueue * @var MailHistory */ protected $mailHistory; - protected $user; + protected $userId; protected $finalUser; - public function __construct($user = null, $finalUser = false) + public function __construct($userId = null, $finalUser = false) { - $this->user = $user; + $this->userId = $userId; $this->finalUser = $finalUser; } @@ -104,7 +104,7 @@ public function failed($exception) $mail_template->getValue('mail_subject'), $mail_template->getValue('mail_body'), $this->notify_id ?? -1, - $this->user->id, + $this->userId, \Exment::getUserId() ?? null, $this->mailHistory->getParentId(), $this->mailHistory->getParentType() diff --git a/src/Notifications/MailSender.php b/src/Notifications/MailSender.php index 2acdc66e7..2973c3dc8 100644 --- a/src/Notifications/MailSender.php +++ b/src/Notifications/MailSender.php @@ -241,7 +241,7 @@ protected function sendMail() ->setFromName($fromName) ->setBodyType($bodyType); - $job = new MailSendJob(\Exment::user(), $this->final_user); + $job = new MailSendJob(\Exment::getUserId(), $this->final_user); $job->setMailInfo($this->mailInfo) ->setMailHistory($this->mailHistory); $this->notify($job); @@ -281,7 +281,7 @@ protected function sendPasswordMail() ->setMailTemplate($mail_template) ->setHistory(false); - $job = new MailSendJob(\Exment::user(), $this->final_user); + $job = new MailSendJob(\Exment::getUserId(), $this->final_user); $job->setMailInfo($mailInfo) ->setMailHistory($mailHistory);