Contact Form

General plugins (Local) ::: local_contact
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.
Latest release:
2908 sites
53 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 cyber sec
    Mon, Jan 11, 2021, 7:48 AM
    I have the contact form plugin installed. The index.php file, and so on, are in the ../public_html/local/contact/ directory. I stripped down the code, a little, in those particular files, because I kept getting a sesskey error.
    But, as you can see, there is nothing wrong with the html code, or php code. I have tried these outside of moodle, and they work.
  • Picture of Michael Milette
    Tue, Jan 12, 2021, 1:14 AM
    Hi cyber sec. I can only try to help you here if you use the FilterCodes plugin as it was designed to be used. In order to help you with your sesskey error, see

    If you are committed to making your code work, I suggest you ask your question in the developers forum. I will give you a hint though - you've stripped out too much code when making your sendmail.php.
  • Picture of Blair F.
    Wed, Jan 13, 2021, 3:21 AM
    I know I'm probably just blind, but I cannot figure out how to get the 'reply to' address to be that of the person filling in the form. I can see how to make it Moodle's noreply address, or to override that to something else for all messages, but not how to make it dynamic and show the user. I thought maybe putting the filtercode {email} into the 'custom sender' field would help, but it just defaulted to the noreply address.
  • Picture of Michael Milette
    Wed, Jan 13, 2021, 10:09 AM
    Hi Blair, the reply to address is automatically populated with the senders email address. However you cannot see this unless you view the SMTP header. Another way to see it is to simply click reply to an email you receive. You will then notice that the return address is not the same as the From field. The reason for this is that most SMTP (i.e. email) servers do not allow emails to be sent from an email address that it does not recognize. This actually makes sense when you think about it because it is your website sending the email and not really the user. Anyway, this is why there is a from address and a reply-to address. If you want to discuss the further, please start a discussion on the discussion forum at . If you think you have a valid valid case for a dynamic "from" field, please submit your feature request at . I don't think it would be much work to develop a solution but I would want to make sure that it is going to actually work for you before I invest my time. Like I said, most mail servers would reject this.

    Best regards,

  • Picture of Blair F.
    Thu, Jan 14, 2021, 5:55 AM
    Ah, OK. Thank you for that very good explanation. Our messages go from the contact form to our support email address and are then picked up by our HelpDesk software (TeamDynamix). The tickets being created in TeamDynamix are using the FROM and not the REPLY TO to determine the ticket initiator. I will look at this further to see if I can figure out if there's anything I can do and then follow your suggests of posting in the forum and possibly a feature request. Thank you again. You are very responsive, and that's greatly appreciated.
  • Picture of cyber sec
    Fri, Jan 15, 2021, 4:03 AM
    Okay, I figured out what I left out in sendmail.php. Not sure why I saved the file like that, but it was obvious when I took a look. Seems to be working now. Thank you.
  • Picture of Michael Milette
    Sat, Jan 16, 2021, 2:40 AM
    You are very welcome Blair and cyber sec. Have a great weekend!
  • Picture of cyber sec
    Sun, Feb 14, 2021, 5:21 AM
    Gmail works as an outbound mail server in Moodle, but not with this plugin.

    I have created a account to use for outbound email on Moodle. This works on Moodle, I have ran the outbound mail test, and I have tested student self registration. I have done these tests multiple times, it always works.

    But it does not work when using this plugin. I have put echo statements in sendmail.php to make sure that sendmail.php is being called correctly, and that all the information is correct. But the message is never sent to the account.
    echo "email $email";
    echo "subject $subject";
    echo "message $message";
    mail("", $email ,$subject, $message);
  • Picture of Michael Milette
    Sun, Feb 14, 2021, 6:11 AM
    If you want help, please move this discussion to the discussion forum.
  • Picture of R A
    Fri, Apr 2, 2021, 5:34 AM
    After installing this plugin to our Moodle version 3.0+ using PHP 5.4, I am not able to go back to site administration. I got the following error

    JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

    Is there a way to resolve this? The clients do not want to upgrade their Moodle version.

    Thank you
  • Picture of Michael Milette
    Sun, Apr 4, 2021, 10:16 PM
    Hi RA, I am not sure why Contact Form would cause this problem as it does not use json. However I have seen this problem when running older versions of Moodle on Windows but it is unrelated to the plugin. If you think it is related, you could simply delete the /local/contact directory.
  • Picture of R A
    Thu, Apr 15, 2021, 12:54 AM
    Thank you, Michael. I think it's the php version that we used (5.4). I ended up deleted the plugin from the server and everything worked.
  • Picture of Steve Marsh
    Sat, May 8, 2021, 5:44 AM
    I have the plugin working great as a contact form but have also modified some fields in a second form to look similar to a booking form by changing the html and rather than having to type dates in have used some date pickers in the format dd-mm-yyyy, this also works well but despite everything on site being in english (en), the output in the sent email is in yyyy-mm-dd us format, is there anyway to edit/change the output to match the input ?

    Secondly I have seen it in th wiki pages and these comments that the confirmation message can be changed but not can't see how / where to do that, can ou point me in the right direction to change the message ?

    Many Thanks for any help.
  • Picture of Michael Milette
    Sun, May 9, 2021, 8:19 AM
    Hi Steve,

    Please ask your questions in the discussion forum. A link called "Discussion" is provided on the plugin's page.

    For the date format of the date returned by the HTML date picker, it cannot be changed. It is actually an ISO standard format. See:

    The confirmation title, errors and messages are Moodle language strings. Like most strings in Moodle, you can modify it using the Moodle Language editor. Look for the strings associated with the local_contact plugin. For more information on using the language editor, see "Language customisation - MoodleDocs"

    Again, please use the discussion forum for any further questions.

    Best regards,

  • Picture of Steve Marsh
    Mon, May 10, 2021, 6:10 PM
    Hi Michael

    Sorry if I posted in the wrong place, I just thought that since other questions had been asked here and it was directly related to this pluging that this was the best place to post any problems, again sorry for that.

    I understand that the html code defacto is in the yyyy-mm-dd format but as in the link you posted the output is in uk format as 22/07/2018. On our website on the form it shows dd/mm/yyyy and thought it is something that might have been able to change within the plugin for the displayed output but if that is not the case I understand and will have to live with that.

    On the message, I did have a look at the customisation prior to posting but didn't come across it so must have been using the wrong search strings or in the wrong place I guess and will have another look into that one.

    Having said all that I appreciate the help you have given, many thanks for that.


1 2 3 4 5 6 7 8
Please login to post comments