Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Commit

Permalink
bug #286 Fixed custom sendmail command was never considered (Toflar)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.2-dev branch.

Discussion
----------

Fixed custom sendmail command was never considered

I tried configuring a different sendmail command in my Symfony application and noticed that it shows correctly when running `bin/console debug:config swiftmailer` but it's just never considered due to a missing `setCommand()` call on the transport.

Commits
-------

b8db015 Fixed custom sendmail command was never considered
  • Loading branch information
fabpot committed Jun 18, 2019
2 parents 9594593 + b8db015 commit cb125b3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions DependencyInjection/SwiftmailerExtension.php
Expand Up @@ -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'])
;

Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/Fixtures/config/php/sendmail.php
Expand Up @@ -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',
]);
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/Fixtures/config/xml/sendmail.xml
Expand Up @@ -9,6 +9,6 @@
<swiftmailer:config
transport="sendmail"
local-domain="local.example.org"
command="/usr/sbin/sendmail -bs"
command="/usr/sbin/sendmail -t -i"
/>
</container>
2 changes: 1 addition & 1 deletion 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
5 changes: 5 additions & 0 deletions Tests/DependencyInjection/SwiftmailerExtensionTest.php
Expand Up @@ -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());
}

/**
Expand Down

0 comments on commit cb125b3

Please sign in to comment.