Magento – Magento 2: How to change Contact Us Email Type

configurationcontact-usemail-templateshtmlmagento2

magento\vendor\magento\module-contact\etc\email_templates.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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="text" module="Magento_Contact" area="adminhtml"/>
</config>

I have followed Magento 2: how to declare a custom email template for your module

Can we override in app\design or need to create custom module in app\code? If we can override using design then it will be better, because don't want to create new module for this.

<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="Magento_Contact" area="adminhtml"/>
</config>

Tried using magento\app\code\Custom\Module\etc\email_templates.xml But still not working. It's still taking Type as Text.

Best Answer

You need to create a new module for overwrite template config.

Your 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.1.0">
        <sequence>
            <module name="Magento_Contact"/>
        </sequence>
    </module>
</config>

Now 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="Magento_Contact" area="adminhtml"/>
</config>

After changing module.xml file you need to run setup:upgrade command.

Clear cache.