diff --git a/app/Http/Controllers/EmailController.php b/app/Http/Controllers/EmailController.php index 17b3f8ff0a..fb081a9a45 100644 --- a/app/Http/Controllers/EmailController.php +++ b/app/Http/Controllers/EmailController.php @@ -141,7 +141,7 @@ class EmailController extends BaseController if (! $invitation->contact->trashed() && $invitation->contact->email) { $entity_obj->service()->markSent()->save(); - EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data); + EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data)->delay(now()->addSeconds(2)); } }); @@ -194,7 +194,7 @@ class EmailController extends BaseController $data['template'] = $template; - PurchaseOrderEmail::dispatch($entity_obj, $entity_obj->company, $data); + PurchaseOrderEmail::dispatch($entity_obj, $entity_obj->company, $data)->delay(now()->addSeconds(2)); return $this->itemResponse($entity_obj); diff --git a/app/Mail/Engine/InvoiceEmailEngine.php b/app/Mail/Engine/InvoiceEmailEngine.php index e41f0fdc8c..fa88fa67a8 100644 --- a/app/Mail/Engine/InvoiceEmailEngine.php +++ b/app/Mail/Engine/InvoiceEmailEngine.php @@ -143,11 +143,11 @@ class InvoiceEmailEngine extends BaseEmailEngine // Storage::url foreach ($this->invoice->documents as $document) { - $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => $document->getFile()]]); + $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]); } foreach ($this->invoice->company->documents as $document) { - $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => $document->getFile()]]); + $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]); } $line_items = $this->invoice->line_items; @@ -165,7 +165,7 @@ class InvoiceEmailEngine extends BaseEmailEngine ->cursor() ->each(function ($expense) { foreach ($expense->documents as $document) { - $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => $document->getFile()]]); + $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]); } }); } @@ -181,7 +181,7 @@ class InvoiceEmailEngine extends BaseEmailEngine ->cursor() ->each(function ($task) { foreach ($task->documents as $document) { - $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => $document->getFile()]]); + $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]); } }); }