From b8db01581f9c02bcc181a90349753c5e19f7ba4a Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Tue, 18 Jun 2019 15:32:32 +0200 Subject: [PATCH] Fixed custom sendmail command was never considered --- DependencyInjection/SwiftmailerExtension.php | 1 + Tests/DependencyInjection/Fixtures/config/php/sendmail.php | 2 +- Tests/DependencyInjection/Fixtures/config/xml/sendmail.xml | 2 +- Tests/DependencyInjection/Fixtures/config/yml/sendmail.yml | 2 +- Tests/DependencyInjection/SwiftmailerExtensionTest.php | 5 +++++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DependencyInjection/SwiftmailerExtension.php b/DependencyInjection/SwiftmailerExtension.php index 6419ca91..13cfc7ee 100644 --- a/DependencyInjection/SwiftmailerExtension.php +++ b/DependencyInjection/SwiftmailerExtension.php @@ -214,6 +214,7 @@ protected function configureMailerTransport($name, array $mailer, ContainerBuild new Reference(sprintf('swiftmailer.mailer.%s.transport.buffer', $name)), new Reference(sprintf('swiftmailer.mailer.%s.transport.eventdispatcher', $name)), ]) + ->addMethodCall('setCommand', [$mailer['command']]) ->setConfigurator([new Reference(sprintf('swiftmailer.transport.configurator.%s', $name)), 'configure']) ; diff --git a/Tests/DependencyInjection/Fixtures/config/php/sendmail.php b/Tests/DependencyInjection/Fixtures/config/php/sendmail.php index 6469f5d9..f9f4443a 100644 --- a/Tests/DependencyInjection/Fixtures/config/php/sendmail.php +++ b/Tests/DependencyInjection/Fixtures/config/php/sendmail.php @@ -3,5 +3,5 @@ $container->loadFromExtension('swiftmailer', [ 'transport' => 'sendmail', 'local_domain' => 'local.example.org', - 'command' => '/usr/sbin/sendmail -bs', + 'command' => '/usr/sbin/sendmail -t -i', ]); diff --git a/Tests/DependencyInjection/Fixtures/config/xml/sendmail.xml b/Tests/DependencyInjection/Fixtures/config/xml/sendmail.xml index bccae01c..8a6de416 100644 --- a/Tests/DependencyInjection/Fixtures/config/xml/sendmail.xml +++ b/Tests/DependencyInjection/Fixtures/config/xml/sendmail.xml @@ -9,6 +9,6 @@ diff --git a/Tests/DependencyInjection/Fixtures/config/yml/sendmail.yml b/Tests/DependencyInjection/Fixtures/config/yml/sendmail.yml index d824f0c9..a7a177bf 100644 --- a/Tests/DependencyInjection/Fixtures/config/yml/sendmail.yml +++ b/Tests/DependencyInjection/Fixtures/config/yml/sendmail.yml @@ -1,4 +1,4 @@ swiftmailer: transport: sendmail local_domain: local.example.org - command: /usr/sbin/sendmail -bs + command: /usr/sbin/sendmail -t -i diff --git a/Tests/DependencyInjection/SwiftmailerExtensionTest.php b/Tests/DependencyInjection/SwiftmailerExtensionTest.php index 7dd9b6dc..36fb721e 100644 --- a/Tests/DependencyInjection/SwiftmailerExtensionTest.php +++ b/Tests/DependencyInjection/SwiftmailerExtensionTest.php @@ -92,6 +92,11 @@ public function testSendmailConfig($type) $this->assertEquals('swiftmailer.mailer.default.transport.sendmail', (string) $container->getAlias('swiftmailer.mailer.default.transport')); $this->assertEquals('local.example.org', $container->get('swiftmailer.mailer.default.transport')->getLocalDomain()); + + /** @var \Swift_SendmailTransport $transport */ + $transport = $container->get('swiftmailer.transport'); + + $this->assertEquals('/usr/sbin/sendmail -t -i', $transport->getCommand()); } /**