ebizmarts / magento2-mandrill

Mandrill integration for Magento 2.
https://mandrill.com/
36 stars 36 forks source link

Sender email not populated in Order emails for Magento 2.2.4 #65

Closed Silarn closed 6 years ago

Silarn commented 6 years ago

I'm still investigating the issue, but after upgrading our staging server our order emails seem to be failing due to no sender info getting set in the API call.

The test email does work, so the problem must be when it tries to pull the emails for the order.

Silarn commented 6 years ago

This is caused by an addition the \Magento\Sales\Model\Order\Email\SenderBuilder which now uses two classes, the old TransportBuilder and a new TransportBuilderByStore, to set the data on the Message model. I'm not entirely sure why this works with the standard Zend_Mail class, but for this module it was causing two entirely separate instances of the Message class to be created. Since the main TransportBuilder manages creating the transport and dispatching the message, the data set by the TransportBuilderByStore was lost.

My current solution is to override the SenderBuilder class and instantiate the two TransportBuilders and the Message manually, passing the single Message instance to both models. This allows the data set by the TransportBuilderByStore to apply to the same message as the TransportBuilder and fixes the issue.

Silarn commented 6 years ago

I'm working on a local fix and then I'll create a PR for this repo.

klein0r commented 6 years ago

Having the same issue. Have you fixed it @Silarn ?

Silarn commented 6 years ago

See the associated PR