Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ff54513

Browse filesBrowse files
committed
feature #42219 [Mailer] Add support of ping_threshold to SesTransportFactory (Tyraelqp)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Mailer] Add support of ping_threshold to SesTransportFactory | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | Yes | Deprecations? | no | Tickets | Fix #39044 | License | MIT | Doc PR | symfony/symfony-docs#15557 Added support of ping_threshold option to `SesTransportFactory` for `ses+smtp` and `ses+smtps` schemes. Needed because SES closes SMTP connection after 10 seconds of inactivity and `TransportException` will be thrown on next send: `Expected response code "250" but got code "451", with message "451 4.4.2 Timeout waiting for data from client.".` Commits ------- 2e50135 [Mailer] Add support of ping_threshold to SesTransportFactory
2 parents a19735b + 2e50135 commit ff54513
Copy full SHA for ff54513

File tree

2 files changed

+12
-1
lines changed
Filter options

2 files changed

+12
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesTransportFactoryTest.php
+5Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesTransportFactory.php
+7-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.