0

I create a custom email template in my custom module but when I include header and footer they give me an error, if I do not include header and footer then it works fine, please help how to include header and footer in magento2.

my file is: email_templates.xml

<template id="abc_customer_account_approved" label="Abc - Customer account approval" file="account_approval.html" type="html" module="Namespace_Module" area="frontend"/>

My custom email template is:

<!--@subject {{trans "Account Approval email"}} @-->
{{template config_path="design/email/header_template"}}
Hello {{var data.first_name|raw}}, your account has been approved for 
{{store url=""}}
{{template config_path="design/email/footer_template"}}

Error is:

Fatal error: Uncaught Error: Call to undefined method Magento\Framework\Phrase::isMultiPart() in /opt/lampp/htdocs/project_name/vendor/mageplaza/module-smtp/Mail/Transport.php:123 Stack trace: #0 /opt/lampp/htdocs/project_name/vendor/magento/framework/Interception/Interceptor.php(135): Mageplaza\Smtp\Mail\Transport->aroundSendMessage(Object(Magento\Email\Model\Transport\Interceptor), Object(Closure)) #1 /opt/lampp/htdocs/project_name/vendor/dotmailer/dotmailer-magento2-extension/Plugin/TransportPlugin.php(75): Magento\Email\Model\Transport\Interceptor->Magento\Framework\Interception{closure}() 2 /opt/lampp/htdocs/project_name/vendor/magento/framework/Interception/Interceptor.php(135): Dotdigitalgroup\Email\Plugin\TransportPlugin->aroundSendMessage(Object(Magento\Email\Model\Transport\Interceptor), Object(Closure)) #3 /opt/lampp/htdocs/project_name/vendor/magento/module-email/Model/Mail/TransportInterfacePlugin.php(48): Magento\Email\Model\Transport\Interceptor->Magento\Framework\Interception{closure}() 4 /opt/lampp/htdocs/ in /opt/lampp/htdocs/project_name/vendor/mageplaza/module-smtp/Mail/Transport.php on line 123

  • instead of calling that template you can put the header and footer code in that file – Jigs Parmar Aug 27 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.