style: address SMTP review feedback

This commit is contained in:
Torsten Dittmann
2026-04-02 18:52:39 +04:00
parent 31f23695fa
commit 53ca7d0f6b
2 changed files with 3 additions and 12 deletions
+1 -10
View File
@@ -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);
}
}
+2 -2
View File
@@ -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));
}