Contact module overview

Last updated on
6 December 2023

The Contact module allows site visitors to send emails to other authenticated users and to the site administrator.

Uses

Through personal contact forms, users can send one another an e-mail. And through site-wide contact forms, users can send e-mail to arbitrary email addresses, such as the site maintainers.

With either form, users can specify a subject, write their message, and also have a copy of their e-mail sent to their own address. Through contact forms, users allow themselves to be contacted yet keep their own e-mail addresses private until the message is replied to. As an administrator, you can enable or disable the contact module altogether.

As a user, you can also enable or disable your personal contact form if that option has been provided. When the form is enabled, a contact tab is displayed in your user profile, for everyone to see. (Privileged users such as site administrators can contact users who have turned their forms off, as they can access their user account email addresses.) When you visit your own profile, the contact tab is not displayed. However, it is displayed to other users (if it has been enabled).

You can create several separate contact forms for different categories.

You can specify the text to display on your site-wide contact page and you can optionally limit how many times a user can submit a contact form in an hour.

Note that the contact form is set to disable showing the 'send to myself' option to end users only if the user is not an anonymous user! To override this setting will require overriding the default access setting. There is also a simple  contributed module called Contact message feedback form anonymous to assist with this if required.

Configuration

Enabling Contact module

To enable the Contact module:

  1. Navigate to the Modules administration page Menu > Extend or http://example.com/admin/modules
  2. In the Core module section, enable the Contact module.
  3. Click Save configuration.

Configuring the site-wide Contact form

  1. Navigate to the Contact Form administration page (Menu > Structure > Contact forms or http://example.com/admin/structure/contact)
  2. Click "Add contact form" and enter the following information:
  • Label: Enter a title.
  • Recipients: Enter one or more email addresses. Separate each address with a comma.
  • Auto-Reply: Enter an optional response such as an acknowledgement of receipt. Leave this field empty if you do not want to send an automated response.
  • Weights: Set the order in which the contact forms will be displayed.
  • Selected: Specify whether you want this contact form selected by default.
  • Click "Save".
  • This form will render at /contact. It can also be rendered as a block using the contact_block module.

Configure the user Contact form

  1. Navigate to the Account Settings page (Administration > Configuration > People > Accounts or http://example.com/admin/config/people/accounts)
  2. In the Contact settings section specify whether the contact form is enabled for users by default.
  3. Click "Save configuration."

Controlling repeat submission blocking (flood control)

To prevent spam and other abuse, there are hard-coded limits on how frequently contact forms can be submitted. In Drupal 8+, you can view the current/default settings with a drush command:

drush config-get contact.settings

You can change the submission limit and the time limit for resetting flood restriction with another drush command:

drush cedit contact.settings

Menu link

If you want your contact form to appear in a menu, go to Structure → Menus → Footer. Click on the "Enabled" checkbox at the right of the Contact item, click on "Save" at the bottom. For other edit options click on "edit" at the right of the Contact item, and in "Parent link" you can choose a different menu if you prefer. Thanks to the "weight" you can choose where the item will appear in the menu. The heavier the item the lower it will appear (for a vertical menu) or more to the right for a horizontal menu. Don't forget to click on "Save". No matter which menu you choose, you can move the Contact item to the location you want by dragging and dropping its handle in the form of arrowed cross, on the left. This will change the item weight. Don't forget to click on "Save". If you want to translate the menu item for your contact form, do it with the interface translation feature of the contributed module "internationalization": see HowTo: Basic Internationalization setup.

Adding content to the form

If you want to add text (for instance your phone number) or photos etc. to your form page, you can do that by adding a block (or several blocks) which will appear only on the contact form.

Tags

Help improve this page

Page status: No known problems

You can: