Commit 41bee39
committed
feature symfony#54939 [Mailer] Add
This PR was merged into the 7.3 branch.
Discussion
----------
[Mailer] Add `retry_period` option for email transport
| Q | A
| ------------- | ---
| Branch? | 7.2
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues | Fix symfony#50981 symfony#52551
| License | MIT
RoundRobinTransport constructor has retryPeriod set to 60 seconds. This cannot be configured right now.
Let's say all the transports fail (e.g. email address with domain that does not exist).
Problems:
1. When sending more than one email synchronously we can't send emails following the one that failed. We have to sleep(x) where x >= 60sec. (of course we have to handle the TransportException thrown by invalid email but this is another topic)
2. When using Messenger and async emails we don't have to worry about handling TransportException because invalid message will be sent back to the queue however the worker cannot consume another messages for the next 60 seconds. Also logs will be flooded with exceptions because in this 60s window a lot of messages could be tried.
This PR permits to specify a retry period using a new DNS option `retry_period` like `MAILER_DSN="roundrobin(postmark+api://ID@default sendgrid+smtp://KEY@default)?retry_period=15"`
Commits
-------
9716a89 Simplify code
c5703ae Add retry_period option for email transportretry_period option for email transport (Sébastien Despont, fabpot)File tree
2 files changed
+10
-0
lines changed- src/Symfony/Component/Mailer
- Tests
2 files changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
148 | 153 | | |
149 | 154 | | |
150 | 155 | | |
| |||
0 commit comments