Closed Cruiser13 closed 6 years ago
we also ran into a situation like this. We used the default Pimcore Mail Events to do this:
<?php
class MailAttachmentListener implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [ MailEvents::PRE_SEND => 'doSomething' ];
}
public function doSomething(MailEvent $event)
{
$mail = $event->getMail();
$order = $mail->getParam('object');
if (!$order instanceof OrderInterface) {
return;
}
if ($mail->getDocument()->getKey() !== 'order-confirmation') {
return;
}
// do something.
}
}
I know, it's not the best solution but currently there is no other way.
Maybe we should trigger an CoreShopNotificationEvent in all *MailActionProcess
with the current notification entity and the Mail
Instance just before the $mail->send()
.
I though about having a checkbox sendToDesignatedRecipient
to solve the issue. Having an event would be a different thing.
For BC Reasons better doNotSendToDesignatedRecipient
And how do change the recipient after you checked that thing? Also: There could be 100 cases when a mail needs additional or different data, like attachments, bcc, reply to etc.
yes, as I said that is a different issue. But currently it is not possible to send a order mail to the administrators without having the mail sent to the customer as well.
done
Thanks!
It should be possible to send notification mails to email adresses other than the customer. If you want to inform the shop owner that a new order has been placed, it'll also always send this mail to the customer who placed the order.