Contact Form

General plugins (Local) ::: local_contact
Maintained by Michael Milette
Contact Form is a Moodle plugin that allows your site to process and send information submitted through HTML web forms to the site's support email address or primary administrator if the support email address is not defined.
Latest release:
5263 sites
101 fans
Current versions available: 1

The Contact Form plugin for Moodle processes information submitted through a custom web form, sending it by email to the site's support email address, if defined, or to the primary system administrator.

Examples uses for this plugin include:

  • Contact us form.
  • Support request form.
  • Request a course form.
  • Information request form.
  • Lead generation form.
  • Membership application form.

Share with us how you use this plugin on your site.

Note: This is not a web form builder but a form processor. You must have some knowledge of how to create HTML forms or at the very least be able to cut and paste the example included in the README file.

Contact Form templates

If you are not familiar with HTML, consider using the following easy to use plain text {form...} tags included with the FilterCodes plugin. These will generate a Contact Form templates and therefore require that you have the FilterCodes plugin installed and activated.

  • {formquickquestion} : Adds a "quick question" form to your course. Form includes Subject and Message fields. Note: User must be logged in or the form will not be displayed.
  • {formcontactus} : Adds a "Contact Us" form to your site (example: in a page). Form includes Name, Email address, Subject and Message fields.
  • {formcourserequest} : Adds a "Course Request" form to your site (example: in a page). Unlike Moodle's request-a-course feature where you can request to create your own course, this tag allows users to request that a course they are interested in be created. Could also be used to request to take a course. Form includes Name, Email address, Course name, Course Description.
  • {formsupport} : Adds a "Support Request" form to your site (example: in a page). Form includes Name, Email address, pre-determined Subject, specific Subject, URL and Message fields.
  • {formcheckin} : Adds a "I'm here!" button to your to your course. Form does not include any other fields. Note: User must be logged in or the button will not be displayed.

The initial work for this project was sponsored by the kind folk at l'Action ontarienne contre la violence aux femmes. Contact Form benefits from ongoing development by TNG Consulting Inc..

Potential privacy issues

Reminder: Email message protocols may cross the Internet and store messages on mail servers in unencrypted plain text. If you are sending messages outside of your local area network, it is highly recommended that you do not use this plugin to collect sensitive information such as social insurance or credit card numbers. It has nothing to do with this plugin's functionality but just with the way email protocols work. This plugin on its own does not store any information - anywhere.


Screenshot #0
Screenshot #1
Screenshot #2


Michael Milette (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Pedro Garcia
    Mon, Oct 30, 2023, 9:58 PM
    is it possible to load categories and courses without any big code change in this form?
  • Michael Milette
    Tue, Oct 31, 2023, 1:04 PM
    Hi Pedro,

    You can put anything you want in the HTML of the form. The creation of the form is up to you. That is not part of this plugin.

    The Contact plugin is just a webmail form processor that takes whatever you submit from a form and delivers that information by email.

    So, feel free to load the form with a list of courses or categories in a dropdown field. Whichever the user picks will be delivered in the email.

    Best regards,

  • Halie Carton
    Thu, Nov 23, 2023, 12:27 AM
    Hi Michael,

    With the 4.3 update, are users that are not logged into Moodle still able to fill out a contact form made with this plugin?

    Halie Carton
  • Michael Milette
    Thu, Nov 23, 2023, 1:10 AM
    Hi Halie,

    Contact Form does not create the form. You need to do that in HTML or using one of the {form...} template tags included with FilterCodes. Whether or not a user has access to the form depends on where you put the form and what access a person has to that block or page on the site. Are you experiencing an issue specifically with 4.3 or is this just a general enquiry?

    Best regards,

  • Halie Carton
    Thu, Nov 23, 2023, 1:32 AM
    Thanks Michael!

    This question is specifically for 4.3. We want users to be able to contact us if they have an issue from the Login page, without having to sign in. Moodle has apparently increased security with this latest version (which is good) but according to our Moodle Admin, the increased security means that users can't no longer access the support form from the Login page without signing in. He's currently storing the support form on our site using Static Pages. He created the form using Filter Codes. He's also said that with Moodle 4.3, we aren't able to embed external links into the Login page (for security reasons).

    I'm trying to better understand the issue so I can offer an alternative option. What do you think?

    Thank you for your time.

    Halie Carton
  • Michael Milette
    Thu, Nov 23, 2023, 5:46 AM
    Hi Halie,

    I see the problem. Fortunately, there is an easy solution but you will need to install the very useful FilterCodes plugin to do it.

    1. Install and activate FilterCodes:

    2. In FilterCodes' settings, add your form's HTML code to create a {global_...} tag. Save.

    3. In your login form, add the {global_...} tag that you created in the previous step. Be sure that the "Pretty HTML format" box is unchecked. Save.

    And voila, your fully functional form should now be embedded in your login page. You can do the same thing if you want to insert a link instead of the full form.

    If you want to take this to the next level, integrate this with a little HTML for a Bootstrap modal form:

    You could then potentially just add an "I can't log in" button to the login page and then have a "Contact support" form pop-up as a modal box.
    Here is a screenshot:

    Hope you find this information helpful.

    Best regards,

    Michael Milette
  • Halie Carton
    Thu, Nov 23, 2023, 6:08 AM
    Thank you so much, Michael.

    Halie Carton
  • Mustafa Hajjar
    Mon, Jan 29, 2024, 11:33 AM
    Hi there,

    I am having problems getting through the '' error. I used both methods the easy FilterCodes and the Custom method using the first example in the README. Both methods display the form fine and both result in the error. I added the referrer script & input as instructed in the README and I tried both ../.. and {wwwroot}.
    I am on Moodle 4.2.2

    I tried posting the code but the forum is rendering the form here! I tried switching my profile preference to 'Plain test area' editor but Moodle Forum still renders the form!

  • Michael Milette
    Mon, Jan 29, 2024, 2:14 PM
    Hi Mustafa,

    I confirmed that this works fine in Moodle 4.2.2 using the latest release of Contact Form. So, here are some troubleshooting steps for you:

    1. If you are using FilterCodes, first confirm that FilterCodes ( works without a form. If it does not, please see the FAQ/troubleshooting section in the documentation ( file).

    2. If FilterCodes is working, please enter the {filtercodes} tag. This will display the version of FilterCodes that you are using. Then, make sure that you are using the most recent version.

    3. Once you have that working, enter the following tag: {formquickquestion}. When the page displays, you should see a form. Fill it out and submit the information. If the message was submitted successfully, ensure that you received the message by email. If you did not, please use the Email Test plugin ( to troubleshoot.

    4. If that worked, then the problem is with the HTML of the form that you created. To get help in the discussion forums, save your HTML code for the complete form to a text file (not HTML or PHP) and attach it to your message. In the body of the message, be sure to include any error messages as well as the name of the Moodle theme you are using and where you are trying to use it (e.g. a block, a page, a lesson, etc).

    Reminder: You can always post screenshots in the discussion forums. But please don't do this with your form. Nobody wants to type all that in.

    I hope you find this information useful.

    Best regards,

    Michael Milette
  • Michael Milette
    Mon, Jan 29, 2024, 2:41 PM
    Hi again Mustafa,

    I checked the HTML of your form. The problem with setting the form action to something that starts with ../../ is that this is a relative path. It will work in some places, like on a page within your course, but not in others, like your course main page/outline. To make it work on the course main page, you can replace it with ../../ with simply ../ . If you can always remember to specify the correct relative path, this works just as well as using the FilterCodes {wwwroot} except in a block that appears in multiple locations. Then it depends on the where it is relative to the web root of your site.

    Here are a couple of solutions that will work consistently:

    1. Specify the full path. Example:


    2. If FilterCodes is working for you, you can use {wwwroot}. This has the advantage that, if you move your course to a different Moodle site that has FilterCodes installed (like a local copy), the path will still work. Example:


    If that doesn't work for you either, check the config.php file of your Moodle site and make sure that there is no forward slash at the end of the $CFG->wwwroot line. Example:

    Will not work if:

    $CFG->wwwroot = '';

    Must be like this:

    $CFG->wwwroot = '';

    I tested the rest of your form and it works in Moodle 4.2.2 if you fix the form's action path.

    For more Contact Form troubleshooting information, please see

    Best regards,

    Michael Milette
  • Mustafa Hajjar
    Sat, Feb 3, 2024, 10:32 PM
    Hi Michael,

    You must be referring to a different discusison forum, the on in the Useful Links here seems to be locked (

    I double checked everything and the code and Moodle configs seem to be fine (wwwroot no trailing forward slashes). My problem is environment specific as the same code works fine on dev (nginx/https) but not in test or prod. Also, the issue is not browser-related as I tested on few browsers on different machines with the same results (dev success, test/prod fail).

    After digging further, I think the HTTP_REFERER tag is getting stripped along the way, I wonder if it is related to Cloudflare services, which we use. The code checks if there is no HTTP_REFERER tag, then the request is considered coming from spambot, which is not the case here.

    I configered the contact form plugin to require login, and the same on the moodle page it is called from (no guest access).

  • Simon Carr
    Fri, Apr 26, 2024, 5:16 AM
    I am having issues with not getting the Message sent page. After the contact us form is filled and I am using filter plugin, the information from the form is sent to the email address but the user is unable to see the Message Sent page or message. So user won't know whether the message was submitted or not.

    Grateful if anyone can shed some light on this as to whether I am missing something.

    Steps I have taken -
    create a Page activity, add the custom html block & add the contact-us filter code.
  • Michael Milette
    Mon, Apr 29, 2024, 3:51 AM
    Hi Simon,

    I am not sure what the issue is that you are experiencing. However, I recently did some work on the plugin specifically on the confirmation page. Please try the update that I published on April 26 and see if it works any better for you. If not, please submit a bug report and I will work with you to try and reproduce your issue. The li k for this is on the plugin's page.

    Best regards,

  • Eurecat Academy
    Mon, Jun 17, 2024, 6:30 PM

    Firstly, thank you for the plugin, it is really useful!

    We are using Moodle 4.1.1+ and are trying to add a contact form in a Database activity inside a course. When we use the code from the custom method in, the form input fields are not visible:

    So, we have used the contact form templates from FilterCodes, but we can't find a way to add a particular recipient (as each form included in each database entry should have a different email recipient). Using the custom method, the code would be, for example:
    Could you please tell me if there is any way to add a different recipient for each form using the FilterCodes contact form template?

    Thank you very much!!
  • Michael Milette
    Mon, Jun 17, 2024, 10:07 PM
    Hi Eurecat,

    Add a "recipient" field if you want to specify a recipient other than the Moodle support email address. For security reasons, this field must contain an alias, not an email address. See the section on Configuring the List of Recipients in the documentation.

    Best regards,

    Michael Milette
1 2 3 4 5 6 7 8 9 10
Please login to post comments