I have created a custom module email template, but I am unable to load the images in custom.html file for email templates.


Create a static block insert images in that block and call it in respected custom.html files

{{block class="Magento\Cms\Block\Block" area='frontend' block_id="my_block"}}

  • Good to know you solved. Nov 28 '17 at 5:44
  • How to include this block to my custom module this block create automatically when my module loads Nov 28 '17 at 6:10

The easiest way is to include the block. For example:


{{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}}

Or, We can pass the data to the email template. For example:


                            {{if logo_width}}
                                width="{{var logo_width}}"

                            {{if logo_height}}
                                height="{{var logo_height}}"

                            src="{{var logo_url}}"
                            alt="{{var logo_alt}}"
  • thanks for the reply where I have to place the images and call it in custom.html file Nov 27 '17 at 18:17
  • Check my code and let me know. Nov 28 '17 at 0:32
  • thanks khoa iam installed one custom module for email load at admin emails but unable call the images infooter section from pub media Nov 28 '17 at 3:23
  • you given a logo urls Nov 28 '17 at 3:24
  • I only give you a sample. You need to build your own. I think it's better if you use the first solution. Nov 28 '17 at 3:25

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.