I created module for email header

Block: INW\EmailOverride\Block\EmailOverride // information about which image show

template: extraheader.phtml // contain a image tag

I put this in custom email template

{{block class="INW\EmailOverride\Block\EmailOverride" name="extraheader_header" orderId=$myvar1 template="INW_EmailOverride::extraheader.phtml"}}

when I am sending email from 2 places

  1. Vendor1_Module1 Observer send email: email sent, working fine no problem extraheader working fine

  2. Vendor2_Module2 Controller send email: email sent but extraheader part missing and showing error in log

main.CRITICAL: Invalid template file: 'INW_EmailOverride::extraheader.phtml' in module: 'INW_EmailOverride' block's name: 'emailoverride_0' [] []

  • Post your code which is easy way to help
    – Sohel Rana
    Aug 31, 2022 at 14:35
  • sorry it was my mistake, Vendor2_Module2 Controller is a admin controller, so extraheader.phtml should be adminhtml/templates/ so I copied extraheader.phtml there and everything working
    – Sandeep
    Sep 1, 2022 at 12:04


Your Answer

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