mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
style: address SMTP review feedback
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user