8000 Add Symfony Mailer support by acasademont · Pull Request #354 · symfony/monolog-bundle · GitHub
[go: up one dir, main page]

Skip to content

Add Symfony Mailer support #354

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
Oct 2, 2020
Merged

Conversation

acasademont
Copy link
Contributor

Add support for the new symfony mailer directly on the bundle after the MailerHandle was added to the bridge on symfony/symfony#33456

Also this can make symfony/symfony-docs#13077 move forward

Tests are failing due to incompatible phpunit versions, not sure how to fix this...

@noniagriconomie
Copy link

@acasademont thank you for working on this, i can help test/try it on a project if needed :)

@mmarton
Copy link
mmarton commented Jul 14, 2020

Can I help somehow to make this PR accepted and included in the next release?
I really want to replace swiftmailer and migrate to symfony's one, and this is a must have feature for me.

@devcut
Copy link
devcut commented Jul 23, 2020

Same @mmarton ...

@noniagriconomie
Copy link

@lyrixx friendly ping :) (cf slack discussion)

// composer.json
// inside a symfony 5.1 app
- symfony/mailer v5.1.5
- symfony/monolog-bundle  v3.5.0 + manual edit files from PR changes
# config/packages/dev/monolog.yaml
# from https://symfony.com/doc/current/logging/monolog_email.html but adapted for "symfony_mailer"
monolog:
    handlers:
        main:
            type:         fingers_crossed
            action_level: critical
            handler:      deduplicated
        deduplicated:
            type:    deduplication
            handler: symfony_mailer
        symfony_mailer:
            type:       symfony_mailer
            from_email: 'error@example.com'
            to_email:   'error@example.com'
            subject:    'An Error Occurred! %%message%%'
            level:      debug
            formatter:  monolog.formatter.html
            content_type: text/html
    // a controller
    /**
     * @Route("/mailer-logger", name="mailer_logger")
     */
    public function log(LoggerInterface $logger)
    {
    	$logger->debug('A "debug"', ['foo' => 'bar']);
    	$logger->notice('A "notice"', ['1' => 1]);
    	$logger->error('A "error"');
    	$logger->critical('A "critical"');
        // ...
}

results

profiler_log

mailer_log

👍

@lyrixx
Copy link
Member
lyrixx commented Sep 7, 2020

@noniagriconomie Thanks a lot for testing 👍🏼

Copy link
Member
@lyrixx lyrixx left a comment

Choose a reason for hiding this comment

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

@acasademont thanks for your first PR 👍🏼

@acasademont
Copy link
Contributor Author

@noniagriconomie sorry for the late reply! quite busy on other fronts, something you tink needs to be changed?

@noniagriconomie
Copy link

@acasademont

something you tink needs to be changed?

no, i was checking this PR (as i want also to remove swiftmailer but still use logger mail feature)
that is why i asked @lyrixx to review (core member) where he asked me to proof test it locally ;)

@lyrixx
Copy link
Member
lyrixx commented Oct 2, 2020

Note: I rebased your PR to ensure it's green, once it's green, we'll merge it 👍🏼

@lyrixx
Copy link
Member
lyrixx commented Oct 2, 2020

Thanks for your work on this new feature!

@lyrixx lyrixx merged commit 24f27fb into symfony:master Oct 2, 2020
@acasademont
Copy link
Contributor Author

thank you!

@devcut
Copy link
devcut commented Oct 6, 2020

I testing the new feature with the same config of @noniagriconomie in one of my project, but it's not working...

  • symfony/mailer v5.1.6
  • symfony/monolog-bundle v3.5.0

I have this error There is no handler class defined for handler "symfony_mailer".

Any one have idea why ?

Thanks

@noniagriconomie
Copy link
noniagriconomie commented Oct 6, 2020

@devcut imo the bundle v3.6.0 will allow to use it (via config like normal) (in preparation cf https://github.com/symfony/monolog-bundle/pull/362/files#diff-4ac32a78649ca5bdd8e0ba38b7006a1eR1)

when testing localy, i updated manually the bundle code to test it (related to #354 (comment) symfony/monolog-bundle v3.5.0 + manual edit files from PR changes)

did you do that on your side?

@devcut
Copy link
devcut commented Oct 6, 2020

Ahhh, I thought it was already available in version 3.5.0 ! I will wait for version 3.6.0 🤓

Thanks you for your explication @noniagriconomie.

@lyrixx
Copy link
Member
lyrixx commented Oct 6, 2020

the v3.6.0 has been released, enjoy 🎉

noniagriconomie added a commit to noniagriconomie/symfony-docs that referenced this pull request Oct 6, 2020
noniagriconomie added a commit to noniagriconomie/symfony-docs that referenced this pull request Oct 6, 2020
@devcut
Copy link
devcut commented Oct 7, 2020

It's working, thank you for this release @lyrixx. 😍

javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Oct 7, 2020
…(noniagriconomie, OskarStark)

This PR was merged into the 5.1 branch.

Discussion
----------

Document usage of Symfony Mailer for error email

Related to symfony/monolog-bundle#354
and symfony/monolog-bundle#354 (comment)

----------

Should we also document that for the `v4.4` of this page, it will not be possible?
The `Symfony\Bridge\Monolog\Handler\MailerHandler` was added in `v5.1` (symfony/symfony#33456)

Because the wording `compatible yet` implies that it will be compatible in the future

Thank you

edit: I do not understand the `DOCtor-RST` check here :s

Commits
-------

202b9e6 Update message
d20f07c Fix: DOXtor-RST
922932f Makes DOCtor-RST happy
3df4d9e Document usage of Symfony Mailer for error email
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0