Skip to content

Commit

Permalink
removed unused code inherited from version 4.0
Browse files Browse the repository at this point in the history
Signed-off-by: sergiu <[email protected]>
  • Loading branch information
SergiuBota1 committed Dec 4, 2024
1 parent 2352b82 commit ddb14f4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 87 deletions.
49 changes: 9 additions & 40 deletions config/mail.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,88 +26,57 @@ 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' => [],
'dir' => [
'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
*/
],
];
10 changes: 0 additions & 10 deletions src/Options/MailOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
18 changes: 0 additions & 18 deletions src/Options/SmtpOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
*/
Expand Down
17 changes: 2 additions & 15 deletions test/CommonTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '',
Expand All @@ -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',
],
],
],
Expand All @@ -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
*/
],
];
}
Expand Down
3 changes: 0 additions & 3 deletions test/Options/MailOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,17 @@ public function testGettersAndSetters(): void
$messageOptions = ['from' => '', 'to' => []];

Check failure on line 22 in test/Options/MailOptionsTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.2, latest], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Equals sign not aligned with surrounding assignments; expected 1 space but found 8 spaces

Check failure on line 22 in test/Options/MailOptionsTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.2, latest], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Equals sign not aligned with surrounding assignments; expected 1 space but found 8 spaces
$smtpOptions = ['host' => '', 'port' => 587];

Check failure on line 23 in test/Options/MailOptionsTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.2, latest], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Equals sign not aligned with surrounding assignments; expected 4 spaces but found 11 spaces

Check failure on line 23 in test/Options/MailOptionsTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.2, latest], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Equals sign not aligned with surrounding assignments; expected 4 spaces but found 11 spaces
$eventListeners = [AbstractMailEventListener::class];

Check failure on line 24 in test/Options/MailOptionsTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.2, latest], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Equals sign not aligned with surrounding assignments; expected 1 space but found 8 spaces

Check failure on line 24 in test/Options/MailOptionsTest.php

View workflow job for this annotation

GitHub Actions / ci / QA Checks (PHPCodeSniffer [8.2, latest], ubuntu-latest, laminas/laminas-continuous-integration-ac...

Equals sign not aligned with surrounding assignments; expected 1 space but found 8 spaces
$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());
}
}
1 change: 0 additions & 1 deletion test/Options/SmtpOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit ddb14f4

Please sign in to comment.