From e3bab623f1c4993891547fa8d3a90c49cabc4daf Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 8 Dec 2023 21:34:39 +0000 Subject: [PATCH] fix redis issue by encoding content --- src/Appwrite/Event/Mail.php | 3 ++- src/Appwrite/Platform/Workers/Mails.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Event/Mail.php b/src/Appwrite/Event/Mail.php index 95fffa90d8..47c9125c01 100644 --- a/src/Appwrite/Event/Mail.php +++ b/src/Appwrite/Event/Mail.php @@ -317,11 +317,12 @@ class Mail extends Event public function setAttachment(string $content, string $filename, string $encoding = 'base64', string $type = 'plain/text') { $this->attachment = [ - 'content' => $content, + 'content' => base64_encode($content), 'filename' => $filename, 'encoding' => $encoding, 'type' => $type, ]; + return $this; } public function getAttachment(): array diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index bb55133c0b..9018f219ae 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -92,7 +92,7 @@ class Mails extends Action $mail->AltBody = \strip_tags($body); if (!empty($attachment['content'] ?? '')) { $mail->AddStringAttachment( - $attachment['content'], + base64_decode($attachment['content']), $attachment['filename'] ?? 'unknown.file', $attachment['encoding'] ?? PHPMailer::ENCODING_BASE64, $attachment['type'] ?? 'plain/text'