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 397abb6

Browse filesBrowse files
committed
feature #46315 [Mailer] max_per_second option configurable via DSN (gassan)
This PR was merged into the 6.2 branch. Discussion ---------- [Mailer] `max_per_second` option configurable via DSN | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | symfony/symfony-docs#16800 This option is available since 5.1, but it was impossible to configure it by dsn. Commits ------- a377f2e made max_per_second option configurable by dsn
2 parents 5d9b6d2 + a377f2e commit 397abb6
Copy full SHA for 397abb6

File tree

Expand file treeCollapse file tree

2 files changed

+12
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-0
lines changed

‎src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportFactoryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportFactoryTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ public function createProvider(): iterable
116116
$transport,
117117
];
118118

119+
$transport = new EsmtpTransport('example.com', 465, true, $eventDispatcher, $logger);
120+
$transport->setMaxPerSecond(2.0);
121+
122+
yield [
123+
new Dsn('smtps', 'example.com', '', '', 465, ['max_per_second' => '2']),
124+
$transport,
125+
];
126+
119127
$transport = new EsmtpTransport('example.com', 465, true, $eventDispatcher, $logger);
120128
$transport->setRestartThreshold(10, 1);
121129

‎src/Symfony/Component/Mailer/Transport/Smtp/EsmtpTransportFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Transport/Smtp/EsmtpTransportFactory.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public function create(Dsn $dsn): TransportInterface
5252
$transport->setLocalDomain($localDomain);
5353
}
5454

55+
if (null !== ($maxPerSecond = $dsn->getOption('max_per_second'))) {
56+
$transport->setMaxPerSecond((float) $maxPerSecond);
57+
}
58+
5559
if (null !== ($restartThreshold = $dsn->getOption('restart_threshold'))) {
5660
$transport->setRestartThreshold((int) $restartThreshold, (int) $dsn->getOption('restart_threshold_sleep', 0));
5761
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.