I want to add my custom link in contact email link. For that, I have created a new email template for the contact email but this is in plain text. enter image description here

So how can I add a link to contact email template OR how can I overwrite the contact email template in my custom module/theme?

As per @VivekKumar answer, please check the below image.

enter image description here

As per @Akhilesh answer, I have overwrite the email_template.xml file in my theme as below. Clear the cache - run content deploy but it loads the template in the plain text.

enter image description here

  • I have used the same code and it works fine for me, try flushing browser and magento cache to see if it fixes the problem May 4, 2018 at 10:43
  • I have done but it still displays as plain text. May 4, 2018 at 10:50
  • Is there anyone who knows the solution? May 9, 2018 at 7:29

2 Answers 2


You will need to change the template type to html from text in file


Take this file in your theme folder and change from text to html

<template id="contact_email_email_template" label="Contact Form" file="submitted_form.html" type="html" module="Magento_Contact" area="frontend"/>
  • Seems to be the correct answer. May 4, 2018 at 11:16
  • Tried but it still loads the template in plain text. May 4, 2018 at 11:45
  • Changing type of entire email templates to html just to make a link work doesnt seem fine to me. May 4, 2018 at 12:29
  • @VivekKumar vendor/magento/framework/Mail/Template/TransportBuilder.php check prepareMessage function. It is checking that template file is plain text or html. getTemplate() function will set the all template variables which we declare in email_templates.xml file. May 4, 2018 at 12:41
  • @JigarDhaduk Hopefully you deploy and clear cache after making this changes. May 4, 2018 at 12:42

Place your link's html inside {{trans '<your html>' |raw}} enclosure to ask it to be rendered as html and not as text. So, it should look as follows :

{{trans '<a href="www.example.com">example</a>'|raw}}
  • I tried, please check the updated answer. May 4, 2018 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.