Merge pull request #7262 from appwrite/feat-mail-worker-attachment-support

fix redis issue by encoding content
This commit is contained in:
Damodar Lohani 2023-12-08 22:44:38 +01:00 committed by GitHub
commit 3b7fa3d664
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -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

View file

@ -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'