From 7dfa86c70f86d7a7711ddc963d3076cf30cbb984 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 22 Oct 2022 17:31:04 +1100 Subject: [PATCH] Improve reliabilty of attachments for emails --- app/Mail/TemplateEmail.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index e0ef5317e617..cbf07442c075 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -146,10 +146,17 @@ class TemplateEmail extends Mailable } + //22-10-2022 - Performance - To improve the performance/reliability of sending emails, attaching as Data is much better, stubs in place foreach ($this->build_email->getAttachments() as $file) { if (is_string($file)) { + // nlog($file); + // $file_data = file_get_contents($file); + // $this->attachData($file_data, basename($file)); $this->attach($file); } elseif (is_array($file)) { + // nlog($file['path']); + // $file_data = file_get_contents($file['path']); + // $this->attachData($file_data, $file['name']); $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]); } }