Skip to content

Fix mailer example #12838

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

Closed
wants to merge 1 commit into from
Closed

Fix mailer example #12838

wants to merge 1 commit into from

Conversation

rosier
Copy link
Contributor

@rosier rosier commented Dec 23, 2019

Changed the type hint to Symfony\Component\Mailer\Transport\TransportInterface instead of Symfony\Component\Mailer\MailerInterface to get Symfony\Component\Mailer\SentMessage from the send method.

Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

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

Please keep the message Id example

@rosier
Copy link
Contributor Author

rosier commented Dec 23, 2019

I have now changed the type hint instead of removing the message Id example

@rosier rosier requested a review from OskarStark December 28, 2019 14:23
@javiereguiluz
Copy link
Member

@rosier thanks for this contribution!

I personally had issues with this example and I couldn't understand why we didn't show the SentMessage example ... so I added it myself ... but now I understand why I was wrong.

Now I'm divided about this. Using MailerInterface is great, concise and looks beautiful. Using the TransportInterface in the very first mailer example looks ugly in my opinion.

Also, I don't understand why I can't get the SentMessage object with MailerInterface. It looks so obvious and basic to me ... I'm probably missing something here.

@rosier
Copy link
Contributor Author

rosier commented Jan 2, 2020

Using MailerInterface you can also send email async using a message bus. In that case there is no sent message yet.

Maybe it's better to revert this example and add an example using TransportInterface under
https://symfony.com/doc/current/mailer.html#debugging-emails

@HeahDude
Copy link
Contributor

Maybe it's better to revert this example and add an example using TransportInterface under
https://symfony.com/doc/current/mailer.html#debugging-emails

Or maybe we can add a comment about getting a SentMessage only with synch transports.

@rosier
Copy link
Contributor Author

rosier commented Feb 26, 2020

Closing in favor of #13194

@rosier rosier closed this Feb 26, 2020
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.

5 participants