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.
792 sites
31 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


  • Picture of Michael Milette
    Sun, May 20, 2018, 10:16 PM
    Hi Feilipe, PLEASE POST IN THE DISCUSSION FORUM or CREATE AN BUG TRACKER ISSUE (see links on plugin page). I know it can be very frustrating when something like this happens. I am not sure what you mean by a folder called ../moodle/local/contact. Assuming you meant the correct folder location, you should not put the plugin folder in there but the contents of the plugin folder in there. For more information on manually installing a Moodle plugin, see
  • Picture of InsightKorea JobS
    Sun, Jul 1, 2018, 4:27 PM
    Hello Michael,
    I love this.
    But I got a error message like this. 'deny. "sesskey" field is missing or contains an incorrect value.'
    I searched all document about this error. But I did'n find solution.
    What's problem? Please help me.

    moodle 3.5(20180621)
    mariadb (10.1.31)
    smtp mail is ok
  • Picture of InsightKorea JobS
    Sun, Jul 1, 2018, 9:34 PM
    I solved it.
    value="" -> value="{sesskey}"
    in the sample template
    I hope to help some people.
  • Picture of Michael Milette
    Wed, Jul 4, 2018, 12:40 PM
    Hi Polaris,

    Glad to see that you were resourceful and found a workaround. However, your solution actually results in bypassing one of the anti-spam strategies. The value should actually be empty and will be filled by the JavaScript snippet on the next line in the sample template:
    < script>document.getElementById('sesskey').value = M.cfg.sesskey;< /script>
    If you tried that and it doesn't work, it is very possible that you have other JavaScript errors in your page which is causing this snippet to fail. When it works, it requires that SPAMbots be able to run JavaScript. If they can't, the sesskey is never filled and you don't get junk emails.

    While your approach will certainly work, it just let through more SPAM emails. If you would like to continue this conversation, please feel free to move it to the Discussion forum. You'll find the Discussion link on the Contact Form plugin page.

    Best regards,

  • Picture of InsightKorea JobS
    Wed, Jul 4, 2018, 8:35 PM
    Hello Michael,
    Thank you for your kind reply.
    I am not a developer. I can not fix it.
    I will try hard to fix it though it will be hard to fix right now.
  • Picture of Philip Jones
    Sat, Aug 25, 2018, 12:56 AM
    Is there any way to send the email to multiple recipients?
  • Picture of Michael Milette
    Sat, Aug 25, 2018, 2:30 AM
    Hi Philip,

    Thank you for your question. You can send the email from Contact Form for Moodle to multiple recipients by creating a mailing list (sometimes called a group mailing list). Then configure Contact Form to send the message to that mailing list's email address. See your email administrator or service provider for instructions on how to do this.
  • Picture of umer Ahmed
    Thu, Oct 18, 2018, 8:41 AM
    Any idea on how to use this plugin by making a form using Moodle form api
  • Picture of Michael Milette
    Fri, Oct 19, 2018, 9:37 AM
    Hi Umer, unfortunately you can't. It's not made to work with the Moodle form API. It's made to enable people who don't know anything about programming but have a little knowledge of HTML to add webmail forms to their website. If you can copy and paste HTML or create an HTML form and want form submissions to be delivered to you by email, then this plugin is for you.
  • Picture of Blair F.
    Sat, Nov 17, 2018, 6:06 AM
    Michael, I'm just looking through your code and laughing out loud. I love your comments. "//Naughty naughty. We know all about your kind."
  • Picture of Michael Backus
    Mon, Jan 20, 2020, 8:48 AM
    Thanks for sharing this plugin. I've installed it and everything seems to be working great. I'd like to change the confirmation message though, but can't seem to figure out how. I change it in the local_contact.php page inside your plugin, but that didn't do the trick. Any advice? Is there a setting I'm missing?
  • Picture of Michael Milette
    Mon, Jan 20, 2020, 12:24 PM
    Hi Michael, thanks for your question. In Moodle, you don't actually make changes in language files because they gets replaced when you upgrade. Moodle actually has a built-in language editor. It is in Site Administration > Language > Language Customization. The other reason that your changes didn't take effect is likely because you didn't clear the cache. Language strings in Moodle are cached and the language file never gets looked at again until you either change them using the language customization tool or your clear the cache. You can do this by going to Site Administration > Development > Purge Cache. This is just the way all of Moodle works. Hope this helps.
    Best regards,
  • 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.
Please login to post comments