From 211abc7076ca53b2bd0572a6fda1411299d60013 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 19 Jan 2024 10:41:19 +1100 Subject: [PATCH] Updates for forcing build() method again --- app/Jobs/Mail/NinjaMailerJob.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 77ec1d573169..49f4f0b28bd5 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -110,6 +110,7 @@ class NinjaMailerJob implements ShouldQueue $this->nmo->mailable->replyTo($this->company->owner()->email, $this->company->owner()->present()->name()); } + /* Run time we set the email tag */ $this->nmo->mailable->tag($this->company->company_key); @@ -137,9 +138,16 @@ class NinjaMailerJob implements ShouldQueue $mailer->mailgun_config($this->client_mailgun_secret, $this->client_mailgun_domain, $this->nmo->settings->mailgun_endpoint); } + $mailable = $this->nmo->mailable; + + /** May need to re-build it here */ + if(Ninja::isHosted() && method_exists($mailable, 'build')) { + $mailable->build(); + } + $mailer ->to($this->nmo->to_user->email) - ->send($this->nmo->mailable); + ->send($mailable); /* Count the amount of emails sent across all the users accounts */ Cache::increment("email_quota".$this->company->account->key); @@ -575,7 +583,6 @@ class NinjaMailerJob implements ShouldQueue if (class_exists(\Modules\Admin\Jobs\Account\EmailQuality::class)) { (new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run(); } - return true; }