0

I have create one custom module and in this module I have created send email functionality. But In Email header and footer is not send.

So Please help me.

THANKS.

1 Answer 1

0

If you are use send email functionally using controller and other like :-

My Old code is not working header and footer

$transport = $this->transportBuilder
                    ->setTemplateIdentifier('admin_customerapprove_template')
                    ->setTemplateOptions(
                        [
                            'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
                            'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
                        ]
                    )
                    ->setTemplateVars([
                        'customerName'  => $customerFirstName ,
                        'customerEmail'  => $customerEmail,
                    ])
                    ->setFrom($sender)
                    ->addTo($emailSender)
                    ->getTransport();
                $transport->sendMessage();
                $this->inlineTranslation->resume();

After i have find some solution like :-

for

'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID

use

'store' => $this->storeManager->getStore()->getId()

And How to create object for storeManager follow below link :-

https://www.mageplaza.com/devdocs/how-get-store-information-magento-2.html

Hope this help other.

THANKS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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