From 53ca7d0f6bdaab79707fe5d2750894a8410ce0aa Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 2 Apr 2026 18:52:39 +0400 Subject: [PATCH] style: address SMTP review feedback --- src/Appwrite/Platform/Workers/Mails.php | 11 +---------- src/Appwrite/SMTP/SMTP.php | 4 ++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 62b77a1161..d8e3cf51de 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -175,7 +175,7 @@ class Mails extends Action $attachments = null; if (!empty($attachment['content'] ?? '')) { $attachments = [ - self::createAttachment( + new Attachment( name: $attachment['filename'] ?? 'unknown.file', path: '', type: $attachment['type'] ?? 'plain/text', @@ -205,13 +205,4 @@ class Mails extends Action throw new Exception('Error sending mail: ' . $error->getMessage(), 500); } } - - private static function createAttachment( - string $name, - string $path, - string $type, - ?string $content = null, - ): Attachment { - return new Attachment($name, $path, $type, $content); - } } diff --git a/src/Appwrite/SMTP/SMTP.php b/src/Appwrite/SMTP/SMTP.php index da18ef1908..45d286a6d5 100644 --- a/src/Appwrite/SMTP/SMTP.php +++ b/src/Appwrite/SMTP/SMTP.php @@ -6,6 +6,7 @@ use InvalidArgumentException; use Utopia\Messaging\Adapter\Email as EmailAdapter; use Utopia\Messaging\Adapter\Email\SMTP as SMTPAdapter; use Utopia\Messaging\Messages\Email as EmailMessage; +use Utopia\Messaging\Messenger; use Utopia\System\System; class SMTP @@ -48,8 +49,7 @@ class SMTP return new Client(fn (EmailMessage $message): array => $adapters[0]->send($message)); } - $messenger = 'Utopia\\Messaging\\Messenger'; - $sender = new $messenger($adapters); + $sender = new Messenger($adapters); return new Client(fn (EmailMessage $message): array => $sender->send($message)); }