-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer] [DX] Introduce send email command #39173
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
Conversation
Hey! I like what you have done here. Keep up the good work. To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done? Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review. Cheers! Carsonbot |
e34cca3
to
6676087
Compare
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
6676087
to
fa19a00
Compare
src/Symfony/Bundle/FrameworkBundle/Resources/config/console.php
Outdated
Show resolved
Hide resolved
0718900
to
be4adbc
Compare
d3d3f5d
to
e5a6c8e
Compare
e5a6c8e
to
d64c4da
Compare
} | ||
|
||
/** | ||
* {@inheritdoc} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof do we really need all the inheritdoc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
660c670
to
4a139f6
Compare
4a139f6
to
fe1a6b2
Compare
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __construct(?MailerInterface $mailer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: check if I can remove the nullable without breaking everything
Can you please rename your PR title: - [Mailer] introduce debug command - DX
+ [Mailer] [DX] Introduce debug command Thanks |
fe1a6b2
to
2cc5306
Compare
5e6b394
to
00f7a2b
Compare
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
switch ($input->getOption('body-source')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6d29758
to
a899719
Compare
8482ac1
to
796349b
Compare
@@ -5,6 +5,8 @@ CHANGELOG | |||
----- | |||
|
|||
* added the `mailer` monolog channel and set it on all transport definitions | |||
* added `console mailer:send-email` command to check if your mailer configuration or supplier is (still) operational |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* added `console mailer:send-email` command to check if your mailer configuration or supplier is (still) operational | |
* added `mailer:send-email` command to check if your mailer configuration or supplier is (still) operational |
- <info>php %command.full_name% [email protected] [email protected]</info> | ||
- <info>php %command.full_name% [email protected] [email protected] --subject=Test --body=body</info> | ||
|
||
You can get body of message from a file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get body of message from a file: | |
Use a file for the body: |
Aim is to allow to test if your mailer configuration or supplier is operational in production Usage - console mailer:send-email [email protected] [email protected] - console mailer:send-email [email protected] [email protected] --subject=Test --body=body - console mailer:send-email [email protected] [email protected] --subject=Test --body-source=file --body=/path/to/file
796349b
to
7d3f884
Compare
Thanks @chalasr, I didn't see it. |
I close the PR in order to avoid unnecessary pressure to @fabpot. |
This PR was merged into the 6.2 branch. Discussion ---------- Add a mailer:test command | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #43687, Fix #39173, Fix #37409 | License | MIT | Doc PR | This PR introduces a `mailer:test` command that helps test if sending emails works correctly. The only argument is the `To` header. Everything is optional. There is no support for complex emails (STDIN for body, HTML support, attachments, ...) as the goal is to test if a transport works correctly. Note that this command bypasses the Messenger bus if configured to ease testing even when the messenger consumer is not running. Commits ------- dee0d09 Add a mailer:test command
Pain Point
Sometimes in production you might have a doubt whether your mailer is well configured or if your mail supplier is still up and running.
Aim is to allow to quickly check if your mailer configuration or supplier is operational in (production or elsewhere).
This is the same (lighter) feature we had in SwiftMailerBundle.
Usage
console debug:mailer:email:send [email protected] [email protected] --subject=Test --body=body
console debug:mailer:email:send
TODO
console debug:mailer:email:send [email protected] [email protected] --subject=Test --body=body
console debug:mailer:email:send
symfony/mailer
is not installedKeep up the good work 🚀