General plugins (Local): Contact Form

Maintained by Picture of Michael MiletteMichael 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.
1169 sites
36 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. If you are not familiar with HTML, consider using the {form...} tags included with the FilterCodes plugin. You are just one plain text tag closer to having a common webform than you think.

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


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

Comments RSS

Show comments
  • Picture of Michael Milette
    Mon, Jan 20, 2020, 12:30 PM
    Forgot one more thing. If you are trying to get the confirmation email that goes to the sender, although a lot of the code is there and it is even mentioned here and there in the documentation, it is incomplete and is therefore not enabled yet as documented in the README file under the heading Pending Features. Just never got around to finishing that feature.
  • Picture of Michael Backus
    Mon, Jan 20, 2020, 4:34 PM
    Made the change as you described. It's working great. Thanks for your educational response.
  • Picture of Moises Chavarria
    Wed, Jan 22, 2020, 4:03 PM
    I copied and pasted the sample code into an html block of moodle and I think this error.

    412 Error

    Your request got filtered out due to possible security issues.

    One or more things in your request were suspicious (defective request header, invalid cookies, bad parameters)

    If you think you did nothing wrong:
    •try again with a different browser
    •avoid any evil characters inside the request url

    If you are the owner of the website, you can consider revising the rules of the mod_security module or turning it off from your Web Hosting Control Panel.
  • Picture of Paulo Bagorro
    Fri, Apr 10, 2020, 1:30 AM
    Is it possible to place the plugin on the login page? How?I need a "Contact us" for unregistered users.
  • Picture of Michael Milette
    Fri, Apr 10, 2020, 11:52 PM
    Hi Paulo, It is definitely possible. Here is what you need to do:

    1. Go to Site administration > Plugins > Authentication > Manage authentication
    2. Scroll down to the Instructions field.
    3. Insert your form in this field
    4. Click Save Changes at the bottom of the page.

    That's it! Your form will now appear in the section of the page called "Is this your first time here?" on the Moodle login page.

    With that said, if what you really want is to have the ability to approve any registration requests on your site, you might be interested in taking a look at the "Email-based self-registration with admin confirmation" plugin. New users complete would then complete the self-registration process. However, before they can gain access to the site, a Moodle Administrator will receive an email and need to approve. I have used it on a couple of Moodle projects and it seem to work well. You can find the plugin by going to

    Hope one of these solutions help!

    Michael Milette
  • Picture of Paulo Bagorro
    Sun, Apr 12, 2020, 2:18 AM
    Thanks Michael Milette
  • Picture of Michael Milette
    Fri, Apr 17, 2020, 1:46 PM
    Hi Paulo, I just noticed a bug in FilterCodes where it was identifying guest users as logged-in. If you have enabled guest access to your site, you may want to download the latest fixed version currently available on my GitHub site. The bug fix will be included in the next release of Filtercodes.
  • Picture of Anisorf Avecok
    Tue, May 12, 2020, 4:40 PM
    Hi @Michael Milette and all "Contuct Us" contributors.
    Thanks for sharing this plugin with the community.

    I'm having troubles on using the plugin with not authenticated user, it gives me " Invalid $user parameter in get_user_preferences() call". I've checked the configuration of the plugin and I have set Loggin required: false.
    I use the classical template from section Cutom Methods with reCaptha and I have FilterCodes plugin from which I use only {wwwroot}.

    What am I missing?
  • Picture of Michael Milette
    Wed, May 13, 2020, 12:36 PM
    Hi Anisorf, It's not you, it's me. You didn't miss anything. I did.

    There was one spot in my code that resulted in people logged-in as guests as actually being logged-in. The issue has been resolved and the fix will be included in the next release of Contact Form just before the launch of Moodle 3.9 in June. HOWEVER, I would really appreciate it if you would download the latest version from, try it out and let me know if it resolves your problem. Thank you very much for bringing this issue to my attention.

    By the way, since you have FilterCodes, you might be interested in trying out the - new {formsupport} tag or {formcontactus} tags (there are a few more) which were introduced in the November 2019 release. No need to mess around with HMTL. To use it, just add one of these FilterCode tags to a page on your site and you will get an instant form ready to be used. The resulting HTML it produces will be very similar code to that you found in the examples. If you need to customize the form, you can do so using the Moodle language pack editor included with Moodle.

    Thank again for your question, Anisorf. I appreciate having the opportunity to fix that issue and look forward to hearing if this resolved your issue.

    Best regards,

  • Picture of Anisorf Avecok
    Thu, May 14, 2020, 5:15 PM
    Dear Michael, thanks for prompt response.

    I tried the ready to go filtercodes forms, but I choose HTML since I need to customize the labels of the form in a non english language, and if I'm not wrong this is not fully supported in the language pack.

    I did install the github version of the plugin and I confirm that it works well for the not authenticated users except in these two (not common) cases:

    - A user is not logged in but he has an account in moodle. In this case when email of this kind is used I get as a status message

    Invalid $user parameter in get_user_preferences() call
    Debug Info:
    Error code: codingerror
    Stack trace:
    line 2108 of /lib/moodlelib.php: coding_exception thrown
    line 381 of /local/contact/classes/local_contact.php: call to get_user_preferences()
    line 318 of /local/contact/classes/local_contact.php: call to local_contact->moodleuserstatus()
    line 138 of /local/contact/index.php: call to local_contact->sendmessage()

    - Or if I do it second time in the same browser without clearing the browser cache, and again like a non authenticated user but using a mail that is present in the moodle DB, I get:

    Invalid get_string() identifier: 'duplicateemailaddresses' or component 'local_contact'. Perhaps you are missing $string['duplicateemailaddresses'] = ''; in /var/www/vhosts/
    line 353 of /lib/classes/string_manager_standard.php: call to debugging()
    line 7298 of /lib/moodlelib.php: call to core_string_manager_standard->get_string()
    line 394 of /local/contact/classes/local_contact.php: call to get_string()
    line 318 of /local/contact/classes/local_contact.php: call to local_contact->moodleuserstatus()
    line 138 of /local/contact/index.php: call to local_contact->sendmessage()

    Thank again for your support.

    Best regards,
  • Picture of Michael Milette
    Sat, May 16, 2020, 1:29 AM
    Thanks for the feedback Frosina, I will take a look at that this wekeend.
  • Picture of David Samir
    Sat, May 16, 2020, 9:12 AM
    Dear Michael,

    the plugin works great, I've been using it for a while now and I really love it

    the thing is,
    I've been trying to submit a form for multiple recipients at once
    and I can't see anything in the documentation explaining how can I achieve that

    not sure if I could do that or not
    Kindly let me know if that's an option

    Thanks again
  • Picture of Michael Milette
    Sat, May 16, 2020, 9:31 AM
    Sorry David, the ability to send to multiple recipients is not supported. If you want to have multiple recipients, I recommend that you create a mailing list and then direct emails that list's email address.
  • Picture of Michael Milette
    Sun, May 17, 2020, 11:26 AM
    Hi Frosina,

    Contact does support mutliple languages are supported. All you need to do is to go into the Moodle Language Pack editor and add your translation for the plugin. Even better, contribute your translation in AMOS and it should be available in Moodle within a few days. Even the templates can be customized in the FilterCodes plugin making it easy to apply and update templates almost anywhere you want. Did you know? If you only use one of the Contact Form templates, you can put anything you want in the others to turn them into global blocks that you can stick almost anywhere in Moodle.

    On a side note, I will get back to you soon with the issue you reported. However, please report any bugs you find in the Bug Tracker in GitHub. The link to that that is on the plugin's page on
  • Picture of Michael Milette
    Sun, May 17, 2020, 1:20 PM
    Hi Frosina, I think I have resolved your two issues. Please read the comments I posted for you in the bug tracker on GitHub and let me know how it goes:
1 2 3 4 5 6
Please login to post comments