2

In Magento 2.1.1 the contact form seems to encode the html entities and special characters into entities and therefor corrupts the contact form contents.

I noticed that the Transport action sends the mail with type text instead of HTML and I couldn't find a way to set the type as setBodyHtml.

1

Do you really want any user to send any html content in email to you? You will for sure get some spam email from bots trying add external js or img tags. But if you really for some reason need do this you have 2 options:

1) create a custom module and in it create a file etc/email_templates.xml with content:

<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>

2) go to admin panel and in Marketing > Email Templates create a new template for contact form. Then in Stores > Configuration > General > Contacts select this newly created template as Email Template in Email Options group.

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.