Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Symfony/Component/Mailer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ CHANGELOG
-----

* added `NativeTransportFactory` to configure a transport based on php.ini settings
* added `local_domain`, `restart_threshold`, `restart_threshold_sleep` and `ping_threshold` options for `smtp`
* added `command` option for `sendmail`

4.4.0
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public function createProvider(): iterable
new Dsn('sendmail+smtp', 'default'),
new SendmailTransport(null, $this->getDispatcher(), $this->getLogger()),
];

yield [
new Dsn('sendmail+smtp', 'default', null, null, null, ['command' => '/usr/sbin/sendmail -oi -t']),
new SendmailTransport('/usr/sbin/sendmail -oi -t', $this->getDispatcher(), $this->getLogger()),
];
}

public function unsupportedSchemeProvider(): iterable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,29 @@ public function createProvider(): iterable
new Dsn('smtps', 'example.com', '', '', 465, ['verify_peer' => false]),
$transport,
];

$transport = new EsmtpTransport('example.com', 465, true, $eventDispatcher, $logger);
$transport->setLocalDomain('example.com');

yield [
new Dsn('smtps', 'example.com', '', '', 465, ['local_domain' => 'example.com']),
$transport,
];

$transport = new EsmtpTransport('example.com', 465, true, $eventDispatcher, $logger);
$transport->setRestartThreshold(10, 1);

yield [
new Dsn('smtps', 'example.com', '', '', 465, ['restart_threshold' => '10', 'restart_threshold_sleep' => '1']),
$transport,
];

$transport = new EsmtpTransport('example.com', 465, true, $eventDispatcher, $logger);
$transport->setPingThreshold(10);

yield [
new Dsn('smtps', 'example.com', '', '', 465, ['ping_threshold' => '10']),
$transport,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class SendmailTransportFactory extends AbstractTransportFactory
public function create(Dsn $dsn): TransportInterface
{
if ('sendmail+smtp' === $dsn->getScheme() || 'sendmail' === $dsn->getScheme()) {
return new SendmailTransport(null, $this->dispatcher, $this->logger);
return new SendmailTransport($dsn->getOption('command'), $this->dispatcher, $this->logger);
}

throw new UnsupportedSchemeException($dsn, 'sendmail', $this->getSupportedSchemes());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ public function create(Dsn $dsn): TransportInterface
$transport->setPassword($password);
}

if (null !== ($localDomain = $dsn->getOption('local_domain'))) {
$transport->setLocalDomain($localDomain);
}

if (null !== ($restartThreshold = $dsn->getOption('restart_threshold'))) {
$transport->setRestartThreshold((int) $restartThreshold, (int) $dsn->getOption('restart_threshold_sleep', 0));
}

if (null !== ($pingThreshold = $dsn->getOption('ping_threshold'))) {
$transport->setPingThreshold((int) $pingThreshold);
}

return $transport;
}

Expand Down