Contact module overview

Last updated on
1 May 2017

This documentation is out of date. Help make it current.

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 set up "categories" for the site-wide contact form, to allow for multiple recipient options. For example, one category might be "website feedback," and another might be "product information." For each category, you can specify one or more email addresses to which the form will be sent. You can also specify whether or not the user will receive an automatic reply.

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.

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 a Category" and enter the following information:
  • Category: 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 categories will be displayed.
  • Selected: Specify whether you want this category selected by default.
  • Click "Save".

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)

There are hard-coded limits to how frequently contact forms can be submitted. In Drupal 8, a special drush command provides a way to configure flood control behavior:
drush cedit contact.settings
This lets you change the limit and time limit after which the flood restriction resets.

Menu link [needs update]

If you want your contact form to appear in a menu, go to Structure → Menus → Navigation → List links. Click on the "enable" checkbox at the right of the contact item, click on "Save" at the bottom. Then click on "edit" at the right of the contact item, and in "Parent link" choose Main menu. Thanks to the "weight" you can choose at what place the item will appear in the menu. The heavier is the item the lower (for a vertical menu) or the righter (for a horizontal menu and a left-to-right theme) it will appear. Don't forget to click on "Save". In the Main menu list ( Structure → Menus → Main menu → List links) you move the Contact item to the location you want by can dragging and dropping its handle in 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