8000 [Mailer] Allow custom sendmail command · symfony/symfony@fe6a887 · GitHub
[go: up one dir, main page]

Skip to content

Commit fe6a887

Browse files
committed
[Mailer] Allow custom sendmail command
1 parent 4dd6e2f commit fe6a887

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Component/Mailer/Tests/Transport/SendmailTransportFactoryTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ public function createProvider(): iterable
3838
new Dsn('sendmail+smtp', 'default'),
3939
new SendmailTransport(null, $this->getDispatcher(), $this->getLogger()),
4040
];
41+
42+
yield [
43+
Dsn::fromString('sendmail://default?command=/usr/local/bin/sendmail%20-t'),
44+
new SendmailTransport('/usr/local/bin/sendmail -t', $this->getDispatcher(), $this->getLogger())
45+
];
46+
47+
yield [
48+
Dsn::fromString('sendmail://default?command=/usr/local/bin/sendmail+-t'),
49+
new SendmailTransport('/usr/local/bin/sendmail -t', $this->getDispatcher(), $this->getLogger())
50+
];
4151
}
4252

4353
public function unsupportedSchemeProvider(): iterable

src/Symfony/Component/Mailer/Transport/SendmailTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class SendmailTransportFactory extends AbstractTransportFactory
2121
public function create(Dsn $dsn): TransportInterface
2222
{
2323
if ('sendmail+smtp' === $dsn->getScheme() || 'sendmail' === $dsn->getScheme()) {
24-
return new SendmailTransport(null, $this->dispatcher, $this->logger);
24+
return new SendmailTransport($dsn->getOption('command'), $this->dispatcher, $this->logger);
2525
}
2626

2727
throw new UnsupportedSchemeException($dsn, 'sendmail', $this->getSupportedSchemes());

0 commit comments

Comments
 (0)
0