-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Throw event before and after sending email #2619
Conversation
IMO this should be part of #2482 (ping @amenophis)... |
Yes, definitively, wasn't aware of that PR! |
@gonzalovilaseca Can you adjust your PR as the #2482 was merged? |
Sure! |
Ok, I've moved the events to an events class instead of the interface and adapted to the new structure. Let me know your thoughts. |
@@ -62,7 +64,7 @@ public function render(EmailInterface $email, array $data = array()) | |||
} | |||
|
|||
/** @var EmailEvent $event */ | |||
$event = $this->dispatcher->dispatch(self::EVENT_EMAIL_RENDERED, new EmailEvent(new RenderedEmail($subject, $body))); | |||
$event = $this->dispatcher->dispatch(SyliusMailerEvents::EVENT_EMAIL_RENDERED, new EmailRenderEvent(new RenderedEmail($subject, $body))); |
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.
Maybe rename all events like this SyliusMailerEvents::EMAIL_RENDERED
?
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.
👍
@pjedrzejewski @Arn0d @amenophis ping ;) |
use Sylius\Component\Mailer\Model\EmailInterface; | ||
use Sylius\Component\Mailer\Renderer\Adapter\AbstractAdapter; | ||
use Sylius\Component\Mailer\Renderer\RenderedEmail; | ||
use Sylius\Component\Mailer\SyliusMailerEvents; | ||
|
||
/** | ||
* Default Sylius mailer using Twig and SwiftMailer. |
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.
Bad comment here !
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.
This comments where in your master, will change them though.
PR updated! |
Throw event before and after sending email
Thank you Gonzalo! |
In our app we need to add custom headers before sending emails, and thought this might be something other people could need.
Also in
src/Sylius/Bundle/CoreBundle/DependencyInjection/SyliusCoreExtension.php
the mailer services where not being loaded (don't know if this is on purpose or not).