I am created a new contact form using the custom module, how do i integrate with my custom module form details into email templates.

enter image description here

  • You want to replace contact us page form? Mar 18, 2021 at 7:46
  • Yes, you are right, also update email template
    – zus
    Mar 18, 2021 at 7:48
  • How to include my custom form into email template, then only it will applied right?
    – zus
    Mar 18, 2021 at 8:03

2 Answers 2


Create contact_index_index.xml in your custom module layout folder with below code

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="contactForm">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Vendor_Module::your_custom_template_name.phtml</argument>
  • after added the script, where i can see my new contact form in backend?
    – zus
    Mar 18, 2021 at 7:32
  • my layout file : codeshare.io/5RRpnj
    – zus
    Mar 18, 2021 at 7:35
  • Not getting you, you just asked how to set custom template for default contact form block and above code did it. Mar 18, 2021 at 7:44
  • I am created a contact form using custom module, how to update this as my default contact form aslo update in email template
    – zus
    Mar 18, 2021 at 7:47

This is the way if you want to replace contact us page

Go to admin and create a page under Contant-> Pages-> Add new page

Then checkurl of this page in Search Engine Optimization.

Then you have to simply change the url of contact us button

  1. In the admin menu go to Marketing -> URL Rewrites.

  2. Click the Add URL rewrite button.

  3. Select the "Custom" URL rewrite type

  4. Select the store for which you want to create the custom url (which will replace "contact")

  5. In the requested path field type your new custom contact url (e.g. contact-us)

  6. In the target path field type the current contact url (contact)

  7. Clear the cache and you're done

Change url for every store and its done

  • How to update in contact us email template also. after fill this form then it should be go to mail right?
    – zus
    Mar 18, 2021 at 8:09
  • Go through this link mageplaza.com/kb/… Mar 18, 2021 at 8:10

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.