8000 [Mailer] Add support of ping_threshold to SesTransportFactory (closes… · Tyraelqp/symfony@57be7f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57be7f4

Browse files
author
Sergey F
committed
[Mailer] Add support of ping_threshold to SesTransportFactory (closes symfony#39044)
1 parent f3763c8 commit 57be7f4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesTransportFactoryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ public function createProvider(): iterable
116116
new Dsn('ses+smtps', 'default', self::USER, self::PASSWORD, null, ['region' => 'eu-west-1']),
117117
new SesSmtpTransport(self::USER, self::PASSWORD, 'eu-west-1', $dispatcher, $logger),
118118
];
119+
120+
yield [
121+
new Dsn('ses+smtps', 'default', self::USER, self::PASSWORD, null, ['region' => 'eu-west-1', 'ping_threshold' => '10']),
122+
(new SesSmtpTransport(self::USER, self::PASSWORD, 'eu-west-1', $dispatcher, $logger))->setPingThreshold(10),
123+
];
119124
}
120125

121126
public function unsupportedSchemeProvider(): iterable

src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesTransportFactory.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ public function create(Dsn $dsn): TransportInterface
3030
$region = $dsn->getOption('region');
3131

3232
if ('ses+smtp' === $scheme || 'ses+smtps' === $scheme) {
33-
return new SesSmtpTransport($this->getUser($dsn), $this->getPassword($dsn), $region, $this->dispatcher, $this->logger);
33+
$transport = new SesSmtpTransport($this->getUser($dsn), $this->getPassword($dsn), $region, $this->dispatcher, $this->logger);
34+
35+
if (null !== ($pingThreshold = $dsn->getOption('ping_threshold'))) {
36+
$transport->setPingThreshold((int) $pingThreshold);
37+
}
38+
39+
return $transport;
3440
}
3541

3642
switch ($scheme) {

0 commit comments

Comments
 (0)
0