Magento overriding the email header and footer

Magento overriding the email header and footer

September 10, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento overriding the email header and footer

Email templates are an essential part of any e-commerce platform, allowing you to maintain branding consistency across all customer communications. In this post, we’ll take a deep dive into customizing the email header and footer in your Magento store.

Understanding the Email Template Structure

Magento uses a hierarchical template structure for emails. The default header and footer are defined at app/locale/en_US/template/email/html/header.html and app/locale/en_US/template/email/html/footer.html, respectively.

However, simply modifying these files won’t work because Magento loads them in a specific order based on the configuration. This is where our customization process begins.

Overriding Email Templates: The Right Way

To override the default email templates in Magento, you need to use the configuration XML and specify your own templates. Let’s break down the steps:

  1. Create Your Custom Template Files

First, create your custom header and footer files under app/locale/en_US/template/email/html/. For example, rename the default files to include a unique identifier like this:

  • header.html -> header_custom.html
  • footer.html -> footer_custom.html

Then update these files with your desired HTML content. Make sure you follow Magento’s email template syntax.

  1. Update Your Configuration XML

Next, open your custom module’s config.xml file located in <app_code_local_your_module>/etc/. Inside the <global> block, add the following code within the <template> section:

<template>
  <email>
    <design_email_header2 translate="label" module="your_module">
      <label>Email - Header</label>
      <file>html/header_custom.html</file>
      <type>text</type>
    </design_email_header2>
    <design_email_footer2 translate="label" module="your_module">
      <label>Email - Footer</label>
      <file>html/footer_custom.html</file>
      <type>text</type>
    </design_email_footer2>
  </email>
</template>

Replace your_module with the name of your custom module.

  1. Include Your Custom Templates

Finally, include your custom templates in your email templates using the {{template}} directive. For example, if you’re modifying an order confirmation email located at app/locale/en_US/template/email/order_new.html, update it like this:

{{template config_path="design/email/header2"}}
{{layout handle="sales_order_email_template_default" area="frontend" template="your_module/order/new.phtml"}} 
{{template config_path="design/email/footer2"}}

Debugging Your Custom Email Templates

If your custom templates aren’t showing up, here are a few things to check:

  • Ensure your module is enabled and properly configured.
  • Make sure the header_custom.html and footer_custom.html files exist in the correct location.
  • Verify that you’ve included the new templates using the {{template}} directive correctly.
  • Check the Magento logs for any errors or warnings related to email template rendering.

Conclusion

Customizing Magento’s default email header and footer is a powerful way to maintain your store’s branding across all customer communications. By following this guide, you can easily override the default templates with your own designs.

Remember, consistency is key in e-commerce. Ensure that your custom email templates align with your overall branding strategy for a seamless customer experience.

For more advanced Magento customization tips and tricks, check out our blog at Laravel Company. Happy coding!

References

Extensions Themes Configuration Email

Our network