3

I have created custom email template in my custom module for contact form. while submitting form email should have to trigger to admin and end user and email also triggering as per requirement but it is taking header and footer from luma theme. But we need header and footer from our custom theme. Please, below attachment for more clarity: enter image description here

Thanks in advance !

  • I am also facing issue – PMB Dec 8 '17 at 11:19
  • Have you resolved this issue ? – Mohammad Faizan Apr 25 at 13:50
3

I used below code to send mail to customer

$templateOptions = array(
            'area' => Area::AREA_FRONTEND, 
            'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID
        );

 $from = array('email' => $seller_email, 'name' => $post['name']);

            $this->inlineTranslation->suspend();
            $to = array($goshop_email);
            $transport = $this->_transportBuilder->setTemplateIdentifier($template_id)
                    ->setTemplateOptions($templateOptions)
                    ->setTemplateVars($templateVars)
                    ->setFrom($from)
                    ->addTo($to)
                    ->getTransport();
            $transport->sendMessage();
            $this->inlineTranslation->resume();

for

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

use

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

Where

$this->storeManager is alise of Magento\Store\Model\StoreManagerInterface

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.