1

I have created custom module and override contact-us email template. Also, I have changed contact us email type and set html. It's working perfectly. But the problem is when I received email, email header and footer are missing. Logo is not displayed.

Magento version 2.1.7

Here is my code.

module.xml should be [Vendor/RewriteContact/etc/module.xml]

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_RewriteContact" setup_version="2.0.0">
        <sequence>
            <module name="Magento_Contact"/>
        </sequence>
    </module> </config>

email_templates.xml should be [Vendor/RewriteContact/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="contact_email_email_template" label="Contact Form" file="submitted_form.html" type="html" module="Vendor_RewriteContact" area="frontend"/>
</config>

submitted_form.html should be [Vendor/RewriteContact/view/frontend/email/submitted_form.html]

<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<!--@subject {{trans "Contact Form"}} @-->
<!--@vars {
"var data.comment":"Comment",
"var data.email":"Sender Email",
"var data.name":"Sender Name",
"var data.telephone":"Sender Telephone",
"template config_path=\"design\/email\/footer_template\"":"Email Footer Template",
"template config_path=\"design\/email\/header_template\"":"Email Header Template"
} @-->
{{template config_path="design/email/header_template"}}
{{trans "Name: %name" name=$data.name}}
{{trans "Email: %email" email=$data.email}}
{{trans "Phone Number: %telephone" telephone=$data.telephone}}

{{trans "Comment: %comment" comment=$data.comment}}
{{template config_path="design/email/footer_template"}}
  • did you run all this commands in order??. php bin/magento setup:upgrade, php bin/magento setup:di:compile, php bin/magento setup:static-content:deploy, php bin/magento indexer:reindex, php bin/magento cache:flush – Abhishek Panchal Sep 12 '17 at 14:29
  • Yes, I have run all command – Vithal Bariya Sep 12 '17 at 14:32
  • Hi @Vishal Bariya, did you find solution of you problem. I am also facing the same problem. – Mohit Kumar Arora Sep 14 '17 at 13:33
  • Hi @Mohit Kumar Arora, I have try many But can't find solution. – Vithal Bariya Sep 18 '17 at 4:32
1

Although this is not a proper solution; after too much debugging, I fixed the issue by the below process:

  • Create a new template for Contact Us email from Marketing > Email Templates.
  • Check the preview of the template and open page source of the template preview page.
  • Copy HTML source of the portion in which email template content is being shown.
  • Put the copied source into email template and replace the dynamic content with respective variables again.
  • Save the template and apply it from Stores > Configuration > General (Contacts) > Email Options.

Now try it from the frontend. I hope it would help you also.

|improve this answer|||||

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.