0

Send invoice email to custom mail address in magento 2 but create custom email template but face this issue in magento 2.4.6

app/code/YourVendor/YourModule/etc/email_templates/invoice_email_template.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="invoice_email_template" label="Invoice Email Template" file="invoice_email_template.html" type="html" module="YourVendor_YourModule" area="frontend"/>
</config>

invoice_email_template.html

    {{template config_path="design/email/header_template"}}
     <table>
        <tr class="email-intro">
          <td>
           Email: {{var email}}
          </td>
           <td>
           Name: {{var name}}
          </td>
        </tr>
    </table>

   {{template config_path="design/email/footer_template"}}

magento default use html Invoice for your Main Website Store order

Invoice_new.html but not working any suggestion for that

advance thanks for help

1 Answer 1

0

If you are going to create new email template, then follow this steps.

  1. Register the new email template with email_templates.xml like this.

app/code/Vendor/Extension/etc/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="Your_Custom_Template_ID" label="Your_Custom_Template_LABEL" file="invoice_email_template.html" type="html" area="frontend" module="Vendor_Extension"/>
</config>
  1. Then create that html file invoice_email_template.html like this.

app/code/Vendor/Extension/view/frontend/email/invoice_email_template.html

<!--@subject YOUR_SUBJECT@-->
<!--@vars
YOUR_Custom_Variables
@-->
<body>
...............
...............
YOUR CUSTOM CODE
...............
...............
</body>

So in this way, it by default added magento Header and Footer.

4
  • new email template but same as send email invoice button click in invoice section how to same template use differnt file @Dhiren Vasoya Commented Mar 12 at 12:06
  • If you have different question, then ask separately, so other can also help you into that. If my answer help you accept as solution and upvote, so it help other into community as well. Commented Mar 12 at 12:08
  • above question alreday send invoice mail regarding @Dhiren Vasoya Commented Mar 12 at 12:14
  • @RavindrasinhZala there is not any code related to send email into your question. The question is about Email header missing not about email sending code. Commented Mar 12 at 12:24

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.