From ddb14f4ef82da67ef1f04a52039173899ead51e5 Mon Sep 17 00:00:00 2001 From: sergiu Date: Wed, 4 Dec 2024 16:05:02 +0200 Subject: [PATCH] removed unused code inherited from version 4.0 Signed-off-by: sergiu --- config/mail.global.php.dist | 49 ++++++-------------------------- src/Options/MailOptions.php | 10 ------- src/Options/SmtpOptions.php | 18 ------------ test/CommonTrait.php | 17 ++--------- test/Options/MailOptionsTest.php | 3 -- test/Options/SmtpOptionsTest.php | 1 - 6 files changed, 11 insertions(+), 87 deletions(-) diff --git a/config/mail.global.php.dist b/config/mail.global.php.dist index dcc1a61..73efaeb 100644 --- a/config/mail.global.php.dist +++ b/config/mail.global.php.dist @@ -2,20 +2,20 @@ declare(strict_types=1); +use Symfony\Component\Mailer\Transport\SendmailTransport; + return [ /** * Dotkernel mail module configuration - * Note that many of these options can be set programmatically too, when sending mail messages - * actually that is what you'll usually do, these config provide just default and options that remain the same for all mails + * Note that many of these options can be set programmatically too, when sending mail messages actually that is + * what you'll usually do, these config provide just default and options that remain the same for all mails */ - 'dot_mail' => [ //the key is the mail service name, this is the default one, which does not extends any configuration 'default' => [ //tells which other mail service configuration to extend 'extends' => null, - /** * the mail transport to use * can be any class implementing Symfony\Component\Mailer\Transport\TransportInterface @@ -26,42 +26,30 @@ return [ * * defaults to sendmail **/ - - 'transport' => Symfony\Component\Mailer\Transport\SendmailTransport::class, - + 'transport' => SendmailTransport::class, //message configuration 'message_options' => [ - //from email address of the email 'from' => '', - //from name to be displayed instead of from address 'from_name' => '', - //reply-to email address of the email 'reply_to' => '', - //replyTo name to be displayed instead of the address 'reply_to_name' => '', - //destination email address as string or a list of email addresses 'to' => [], - //copy destination addresses 'cc' => [], - //hidden copy destination addresses 'bcc' => [], - //email subject 'subject' => '', - //body options - content can be plain text, HTML 'body' => [ 'content' => '', 'charset' => 'utf-8', ], - //attachments config 'attachments' => [ 'files' => [], @@ -69,45 +57,26 @@ return [ 'iterate' => false, 'path' => 'data/mail/attachments', 'recursive' => false, - ] + ], ], ], - //options that will be used only if Symfony\Component\Mailer\Transport\Smtp\SmtpTransport adapter is used 'smtp_options' => [ - //hostname or IP address of the mail server 'host' => '', - //port of the mail server - 587 or 465 for secure connections - 'port' => 587, - - //connection class used for authentication - //the value can be one of smtp, plain, login or crammd5 - 'connection_class' => 'login', - + 'port' => 587, 'connection_config' => [ - //the smtp authentication identity 'username' => '', - //the smtp authentication credential 'password' => '', - - //the encryption type to be used, ssl or tls - //null should be used to disable SSL - 'ssl' => 'tls', - ] + ], ], ], // option to log the SENT emails 'log' => [ - 'sent' => getcwd() . '/log/mail/sent.log' + 'sent' => getcwd() . '/log/mail/sent.log', ], - - /** - * You can define other mail services here, with the same structure as the default block - * you can even extend from the default block, and overwrite only the differences - */ ], ]; diff --git a/src/Options/MailOptions.php b/src/Options/MailOptions.php index 4e309a1..fe94673 100644 --- a/src/Options/MailOptions.php +++ b/src/Options/MailOptions.php @@ -89,14 +89,4 @@ public function setEventListeners(array $eventListeners): void { $this->eventListeners = $eventListeners; } - - public function getSaveSentMessageFolder(): array - { - return $this->saveSentMessageFolder; - } - - public function setSaveSentMessageFolder(array $saveSentMessageFolder): void - { - $this->saveSentMessageFolder = $saveSentMessageFolder; - } } diff --git a/src/Options/SmtpOptions.php b/src/Options/SmtpOptions.php index db491a7..43f430c 100644 --- a/src/Options/SmtpOptions.php +++ b/src/Options/SmtpOptions.php @@ -15,7 +15,6 @@ class SmtpOptions extends AbstractOptions { protected string $name = 'localhost'; - protected string $connectionClass = 'smtp'; protected array $connectionConfig = []; protected string $host = '127.0.0.1'; protected int $port = 25; @@ -36,23 +35,6 @@ public function setName(string $name): static return $this; } - /** - * Get connection class - */ - public function getConnectionClass(): string - { - return $this->connectionClass; - } - - /** - * Set connection class - */ - public function setConnectionClass(string $connectionClass): static - { - $this->connectionClass = $connectionClass; - return $this; - } - /** * Get connection configuration array */ diff --git a/test/CommonTrait.php b/test/CommonTrait.php index 4a21f3b..6b7e637 100644 --- a/test/CommonTrait.php +++ b/test/CommonTrait.php @@ -58,11 +58,8 @@ private function generateConfig(): array * * defaults to sendmail **/ - 'transport' => SmtpTransport::class, - - // Valid only if the Transport is SMTP - 'save_sent_message_folder' => ['INBOX.Sent'], - 'message_options' => [ + 'transport' => SmtpTransport::class, + 'message_options' => [ 'from' => '', 'from_name' => '', 'reply_to' => '', @@ -84,21 +81,16 @@ private function generateConfig(): array ], ], ], - //options that will be used only if Symfony\Component\Mailer\Transport\Smtp\SmtpTransport // adapter is used 'smtp_options' => [ 'host' => 'testHost', 'port' => 587, - 'connection_class' => 'login', 'connection_config' => [ - //the smtp authentication identity 'username' => 'test', - //the smtp authentication credential 'password' => 'testPassword', - 'ssl' => 'tls', ], ], ], @@ -108,11 +100,6 @@ private function generateConfig(): array 'log' => [ 'sent' => $this->fileSystem->url() . '/log/mail/sent.log', ], - - /** - * You can define other mail services here, with the same structure as the default block - * you can even extend from the default block, and overwrite only the differences - */ ], ]; } diff --git a/test/Options/MailOptionsTest.php b/test/Options/MailOptionsTest.php index d20dd3b..95d241e 100644 --- a/test/Options/MailOptionsTest.php +++ b/test/Options/MailOptionsTest.php @@ -22,20 +22,17 @@ public function testGettersAndSetters(): void $messageOptions = ['from' => '', 'to' => []]; $smtpOptions = ['host' => '', 'port' => 587]; $eventListeners = [AbstractMailEventListener::class]; - $saveSentMessageFolder = ['INBOX.Sent']; $subject->setTransport($transport); $subject->setTransportMap($transportMap); $subject->setMessageOptions($messageOptions); $subject->setSmtpOptions($smtpOptions); $subject->setEventListeners($eventListeners); - $subject->setSaveSentMessageFolder($saveSentMessageFolder); $this->assertSame(SmtpTransport::class, $subject->getTransport()); $this->assertSame($transportMap, $subject->getTransportMap()); $this->assertInstanceOf(MessageOptions::class, $subject->getMessageOptions()); $this->assertInstanceOf(SmtpOptions::class, $subject->getSmtpOptions()); $this->assertSame($eventListeners, $subject->getEventListeners()); - $this->assertSame($saveSentMessageFolder, $subject->getSaveSentMessageFolder()); } } diff --git a/test/Options/SmtpOptionsTest.php b/test/Options/SmtpOptionsTest.php index 3b5bd54..22f7619 100644 --- a/test/Options/SmtpOptionsTest.php +++ b/test/Options/SmtpOptionsTest.php @@ -23,7 +23,6 @@ public function testSmtpGettersAndSetters(): void $this->assertIsString($subject->getName()); $this->assertIsArray($subject->getConnectionConfig()); $this->assertIsString($subject->getHost()); - $this->assertIsString($subject->getConnectionClass()); $this->assertIsInt($subject->getPort()); $this->assertIsInt($subject->getConnectionTimeLimit());