0

A custom email I am sending is sending with the Luma theme, despite my website having a custom theme applied (which works for checkout emails, yet not for my custom mails).

Why is this happening and how can it be fixed?

    $transport = $this->_transportBuilder
        ->setTemplateIdentifier($template)
        ->setTemplateModel('Magento\Email\Model\Template')
        ->setTemplateOptions([
            'area' =>  \Magento\Framework\App\Area::AREA_FRONTEND,
            'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
        ])
        ->setTemplateVars(['data' => $data])
        ->setFrom($sender)
        ->addTo($to)
        ->getTransport();

    $transport->sendMessage();
0

Found the answer, my code was using the default store and I had used the code from an example just to find the most clean way of sending a transactional email... the email renderer loads the theme from the store id provided, default is 0 and my store with the theme is 1.

My theme is not applied globally because of a bug, so people with it set to global making this mistake may not see any issues.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.