Skip to content
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

[Mailer][DX] Add notice log when email recipients are not defined #35818

Closed

Conversation

noniagriconomie
Copy link
Contributor

Q A
Branch? master
Bug fix? no (can it be considered as yes regarding issues comments?)
New feature? no
Deprecations? no
Tickets Fix #35805 + #33753
License MIT
Doc PR none

Hi,

Add a log in order to be aware that no email was sent due to bad data
IF the PR is accepted, is the log level notice the right one?

thx

@carsonbot carsonbot added Status: Needs Review Mailer DX DX = Developer eXperience (anything that improves the experience of using Symfony) labels Feb 21, 2020
@ogizanagi ogizanagi added this to the next milestone Feb 21, 2020
@@ -65,6 +65,8 @@ public function send(RawMessage $message, Envelope $envelope = null): ?SentMessa
}

if (!$envelope->getRecipients()) {
$this->getLogger()->notice('There are no recipients in the mailer envelope. Nothing was sent.');
Copy link
Contributor

@jschaedl jschaedl Feb 21, 2020

Choose a reason for hiding this comment

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

I would have expected a LogicException and a hint about what I can do to fix the problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jschaedl i did not know the logic behind the « ?SentMessage » method return signature

that is why i added a log and not thrown ex and remove the return null

Maybe we need to wait other review comment :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

friendly ping @fabpot as you have commented on related issue #33753

@fabpot
Copy link
Member

fabpot commented Apr 16, 2020

I've fixed the root issue(s) in #36467

@fabpot fabpot closed this Apr 16, 2020
fabpot added a commit that referenced this pull request Apr 16, 2020
This PR was merged into the 4.4 branch.

Discussion
----------

Mailer from sender fixes

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #35818, Fix #35805, Fix #33753 | License       | MIT
| Doc PR        | n/a

Commits
-------

e885860 Fix From/Sender handling in Emails
@noniagriconomie noniagriconomie deleted the feature-mailer-log branch April 17, 2020 06:53
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) Mailer Status: Needs Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Mailer] AbstractTransport silently doing nothing if no recipients set
6 participants