2

I have created a module where I send a custom mail. For this, I have a custom email template.

Now what I want to do is to include the default header and footer that appears in all my Magento emails, in my custom mail.

I tried to include the header and the footer like this but is not working:

{{template config_path="design/email/header_template"}}
 ...content
{{template config_path="design/email/footer_template"}}

and my email_templates.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
        <template id="myid" label="mylabel" file="myfile.html" type="html" module="mymodule" area="frontend"/>
</config>

I need to include also the header template and footer in my custom module because I think that my custom mail doesn't know what is header_template and footer_template? If yes, from where I can take this file and where I should put it?

Thank you in advance!

  • Have created any xml file to call email template in your custom module. – Amrit Pal Singh Jan 10 '18 at 9:47
  • see my upated question – Alin Lupoiu Jan 10 '18 at 9:51
  • plz show your php code which sent a mail. – Rakesh Jesadiya Jan 10 '18 at 10:02
  • have u run any commands after put your codes? – Abdul Jan 10 '18 at 10:02
1

In place of {{template config_path="design/email/header_template"}} you can use the its HTML code.

You can get the HTML codes for header and footer from this path:

/magento/vendor/magento/module-email/view/frontend/email

Place this code into your HTML file. May this works for you.

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.