[4.x] Catch errors when sending user activation email #9382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request implements handling to catch any errors thrown by mailers when sending the user activation email as part of the create user wizard.
Previously, when a mailer threw an exception while sending the activation email and you tried to re-submit you'd hit a validation error due to the email already being used, since the user was created the last time the wizard was submitted.
With the handling added in this PR, the wizard will complete but the user will see a toast message on the next page telling them the email didn't get sent.
Note: The toast will only display if you're using the
sync
queue driver. If you're using a "proper" queue driver, we assume you already know how to handle failed jobs.Fixes #9309.