Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Mailer] Add new events #47080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2022
Merged

[Mailer] Add new events #47080

merged 1 commit into from
Jul 27, 2022

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Jul 27, 2022

Q A
Branch? 6.2
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #42108
License MIT
Doc PR

Dispatching 2 new events: SentMessageEvent and FailedMessageEvent when sending an email.
It allows acting on the SentMessage or the "initial" message in case of a failure.

{
public function __construct(
private RawMessage $message,
private \Throwable $error,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not public and no getter ?

For further potential BC handling?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it, there is a getError() method here 😕

@fabpot fabpot mentioned this pull request Oct 24, 2022
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Feb 3, 2025
…geEvent` (wkania)

This PR was merged into the 6.4 branch.

Discussion
----------

[Mailer] Mention the `SentMessageEvent` and `FailedMessageEvent`

The symfony/symfony#47080 PR was created to solve the problem of [debugging](symfony/symfony#37570) and to get [information](symfony/symfony#42108) about email after it was sent.
The section about [debugging](https://symfony.com/doc/current/mailer.html#debugging-emails) does not mention those events. Added some links for better navigation.

For example what debug returns:

```
< 220 ESMTP SYMFONY.COM
> EHLO [127.0.0.1]
< 250-smtp.symfony.com
< 250-PIPELINING
< 250-SIZE 157286400
< 250-AUTH PLAIN LOGIN PLAIN LOGIN PLAIN LOGIN
< 250-AUTH=PLAIN LOGIN PLAIN LOGIN PLAIN LOGIN
< 250-ENHANCEDSTATUSCODES
< 250-8BITMIME
< 250 SMTPUTF8
> AUTH LOGIN
< 334 VXNlcm5hbWU6
> ZXhhbXBsZUBzeW1mb255LmNvbQ==
< 334 UGFzc3dvcmQ6
> U3ltcGhvbnkg.aXMgQXdlc29tZQ==
< 235 2.7.0 Authentication successful
> MAIL FROM:<[email protected]>
< 250 2.1.0 Ok
> RCPT TO:<[email protected]>
< 250 2.1.5 Ok
> DATA
< 354 End data with <CR><LF>.<CR><LF>
> .
< 250 OK. ID: a20fb6ebbc54d22b
```

P.S.
I see that the checks now can find repeated words:
```
mailer.rst ✘
 1765: The word "the" is used more times in a row.
   ->  ``FailedMessageEvent`` allows acting on the the initial message in case of a failure and some
```

Commits
-------

8e3c1db [Mailer] Mention the SentMessageEvent and FailedMessageEvent in the debug section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Mailer] Simplify getting SentMessage information after send
3 participants