How to get Email Templates in stores configuration in custom Tab. Please find the below link http://prntscr.com/fvi0og

can anyone help me on this. thanks

2 Answers 2


You have to give like system.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
        <section id="paytrade" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="general" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="paytrade_commission_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInStore="1" showInWebsite="1">
                    <label>Test Tab Email Template</label>
                    <comment>Test tab email sent to xyz.</comment>        

showInStore="1" is for show in storeview.

and another file at /app/code/vendor/modulename/etc/email_templates.xml have to like:

<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd">
    <template id="paytrade_general_paytrade_commission_template" label="Test Tab Email Template" file="test_tab_template_email.html" type="html" module="Ewall_Paytrade" area="frontend"/>

and Create email template file at like: /Ewall/Paytrade/view/frontend/email/test_tab_template_email.html

  • thanks..i think there is no full code in the comment
    – Raghu
    Commented Jul 14, 2017 at 5:16
  • I have updated answer Commented Jul 14, 2017 at 5:19
  • ok thanks let me try this and get back to you within 2min
    – Raghu
    Commented Jul 14, 2017 at 5:20
  • this is showing empty page when code applied
    – Raghu
    Commented Jul 14, 2017 at 5:23
  • have you also created file "email_templates.xml" at /app/code/vendor/modulename/etc/email_templates.xml ? Commented Jul 14, 2017 at 5:26

To begin with create a email_templates.xml file in app/code/VendorName/CustomModule/etc folder with the following content.

<?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="section_id_group_id_field_id" label="Customer Credit Report" file="email_report.html" type="html" module="VendorName_CustomModule" area="frontend"/>


Where template id is the email template identifier and a file with name email_report has got its message in html format. The template identifier will be provided based on the section_id_group_id_field_id which we declare it in the system.xml which will be explained in the following sections.

Create a template file in the path app/code/VendorName/CustomModule/view/frontend/email/email_report.html and the content for email can be added by declaring the template variables from the action file. For instance here the Customer details has been set as a content for email.

    {{template config_path="design/email/header_template"}}
<!--@subject Custom Email@-->
<!--@vars {
"var data.email":"Sender Email",
"var data.name":"Sender Name"
} @-->
<strong>Customer Details:</strong>
<p>{{trans “Name:  %name" name=$templateParams.name}}</p>
<p>{{trans “Email:  %Email" Email=$templateParams.email}}</p>
{{template config_path="design/email/footer_template"}}

The Created email template can be configured from the admin by creating the system.xml file. Add a file system.xml with the following code in the path app/code/VendorName/CustomModule/etc/adminhtml/. This will hold a default value for email template which will be defined in config.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<section id="section_id" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<group id="group_id" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="field_id" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Label to your field</label>

Create a config.xml file in the path app/code/VendoName/CustomModule/etc/ for setting the default template value in the admin custom field that has been created using system.xml.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
  • thanks.. tried this one but iam getting empty page
    – Raghu
    Commented Jul 14, 2017 at 5:29
  • in the field_id i have given "paytrade_commission_template" and in the config.xml i kept like this <paytrade_commission_template>custom_email_name</paytrade_commission_template>
    – Raghu
    Commented Jul 14, 2017 at 5:32
  • prntscr.com/fvi86y
    – Raghu
    Commented Jul 14, 2017 at 5:33
  • magento.stackexchange.com/questions/183281/… From this $customEmailPath = 'sales_email/order/template'; I cannot save my custom template for order email so i thought to get from custom path so that it will be like this: $customEmailPath = 'paytrade_commission/email/template';
    – Raghu
    Commented Jul 14, 2017 at 5:42
  • is your section id is paytrade_commission, group id is email and field id is template?
    – Haritha
    Commented Jul 14, 2017 at 5:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.