Open solverat opened 5 months ago
where does pimcore add the to again?
@dpfaffenbauer: Pimcore doesn't, CoreShop does. Because coreshop uses the $mail->setDocument()
, pimcore internally calls setDocumentSettings()
which applies all recipients.
After that, coreshop also adds them here:
Most of the time, shop mails property $to
is empty, because they should be dynamically sent to the customer. But using notification rules with a defined recipient, the mail will be submitted twice.
So we should stop adding that then right? or at least check for duplicates?
Removing this part should be safe, I guess?
This part is covered in MailProcessor->setDocument()
which triggers the setDocumentSettings()
method.
To:
field$this->mailProcessor->sendMail($mailDocument, $order, null, [], $mailParams);
Reason:
https://github.com/coreshop/CoreShop/blob/b814c70d1ef36b7f43ace5e877735617d4235464/src/CoreShop/Component/Pimcore/Mail.php#L53-L61
Which is just a duplicate of pimcores internal mail processor:
https://github.com/pimcore/pimcore/blob/3b9af529ec41cc6a9723dde96714df67b65d6078/lib/Mail.php#L378-L382