diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 0406f27ee647..b1b1c94690eb 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -136,8 +136,8 @@ class NinjaMailerJob implements ShouldQueue $mailable = $this->nmo->mailable; - /** May need to re-build it here */ - if (Ninja::isHosted() && method_exists($mailable, 'build')) { + /** May need to re-build it here @todo explain why we need this? */ + if (Ninja::isHosted() && method_exists($mailable, 'build') && $this->nmo->settings->email_style != "custom") { $mailable->build(); } @@ -675,9 +675,6 @@ class NinjaMailerJob implements ShouldQueue */ private function preFlightChecksFail(): bool { - -(new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run(); - /* Always send regardless */ if ($this->override) { return false; diff --git a/app/Jobs/Payment/EmailPayment.php b/app/Jobs/Payment/EmailPayment.php index 9ab74ceae882..1d1c88313e02 100644 --- a/app/Jobs/Payment/EmailPayment.php +++ b/app/Jobs/Payment/EmailPayment.php @@ -116,6 +116,7 @@ class EmailPayment implements ShouldQueue $invoice->invitations->each(function ($invite) use ($email_builder) { + $cloned_mailable = unserialize(serialize($email_builder)); $nmo = new NinjaMailerObject(); diff --git a/app/Mail/Engine/InvoiceEmailEngine.php b/app/Mail/Engine/InvoiceEmailEngine.php index 9e66b4524fe1..8f9e15f8dbf0 100644 --- a/app/Mail/Engine/InvoiceEmailEngine.php +++ b/app/Mail/Engine/InvoiceEmailEngine.php @@ -134,10 +134,6 @@ class InvoiceEmailEngine extends BaseEmailEngine $this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->invoice->numberFormatter().'.pdf']]); } - // $hash = Str::uuid(); - // $url = \Illuminate\Support\Facades\URL::temporarySignedRoute('protected_download', now()->addHour(), ['hash' => $hash]); - // Cache::put($hash, $url, now()->addHour()); - //attach third party documents if ($this->client->getSetting('document_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) { if ($this->invoice->recurring_invoice()->exists()) { diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php index 32613b80f192..c2d68aef570f 100644 --- a/app/Mail/Engine/PaymentEmailEngine.php +++ b/app/Mail/Engine/PaymentEmailEngine.php @@ -99,7 +99,6 @@ class PaymentEmailEngine extends BaseEmailEngine ->setViewLink('') ->setViewText(''); - if ($this->client->getSetting('pdf_email_attachment') !== false && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { $template_in_use = false; diff --git a/app/Models/Presenters/CompanyPresenter.php b/app/Models/Presenters/CompanyPresenter.php index 085fc2806dd9..00fd2ccbc2dc 100644 --- a/app/Models/Presenters/CompanyPresenter.php +++ b/app/Models/Presenters/CompanyPresenter.php @@ -83,9 +83,9 @@ class CompanyPresenter extends EntityPresenter ]; if (strlen($settings->company_logo) >= 1 && (strpos($settings->company_logo, 'http') !== false)) { - return "data:image/png;base64, ". base64_encode(@file_get_contents($settings->company_logo, false, stream_context_create($context_options))); + return "data:image/png;base64,". base64_encode(@file_get_contents($settings->company_logo, false, stream_context_create($context_options))); } elseif (strlen($settings->company_logo) >= 1) { - return "data:image/png;base64, ". base64_encode(@file_get_contents(url('') . $settings->company_logo, false, stream_context_create($context_options))); + return "data:image/png;base64,". base64_encode(@file_get_contents(url('') . $settings->company_logo, false, stream_context_create($context_options))); } else { return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="; } diff --git a/app/Services/Email/Email.php b/app/Services/Email/Email.php index 661b8aef52c4..e56091c909d5 100644 --- a/app/Services/Email/Email.php +++ b/app/Services/Email/Email.php @@ -314,7 +314,7 @@ class Email implements ShouldQueue $this->logMailError($e->getMessage(), $this->company->clients()->first()); $this->cleanUpMailers(); -$this->entityEmailFailed($message); + $this->entityEmailFailed($message); return; } diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index c3946d619309..111ec0f4f74a 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -561,10 +561,19 @@ class HtmlEngine $data['$spc_qr_code'] = ['value' => $this->company->present()->getSpcQrCode($this->client->currency()->code, $this->entity->number, $this->entity->balance, $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company1', $this->settings->custom_value1, $this->client)), 'label' => '']; - $logo = $this->company->present()->logo_base64($this->settings); + if(Ninja::isHosted()) + $logo = $this->company->present()->logo($this->settings); + else + $logo = $this->company->present()->logo_base64($this->settings); + + $logo_url = $this->company->present()->logo($this->settings); + $data['$company.logo'] = ['value' => $logo ?: ' ', 'label' => ctrans('texts.logo')]; $data['$company_logo'] = &$data['$company.logo']; + + $data['$company.logo_url'] = ['value' => $logo_url ?: ' ', 'label' => ctrans('texts.logo')]; + $data['$company1'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company1', $this->settings->custom_value1, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company1')]; $data['$company2'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company2', $this->settings->custom_value2, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company2')]; $data['$company3'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company3', $this->settings->custom_value3, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company3')];