Last updated 12 January 2016. Created on 2 March 2007.
Edited by krina.addweb, margyly, drupalshrek, densolis. Log in to edit this page.

While a contact form is a simple concept, it can be a bit complex to get set up and operating. Read this whole page before doing it the first time. Don't give up; it really does work.

Setup

The easiest way to add a contact form to a basic Drupal site is to enable the contact module. You do this by clicking on:

  • (Drupal 7) - Administration > Modules
  • (Drupal 6) - Administer > Site building > Modules

You then locate the Contact module and enable it by checking the box and saving your change. (The Contact module is located in the core modules.)

You only get one contact form (at the URL http://mycompany.com/contact) but it can display a dropdown list of "Categories" for the types of issue that the user needs to contact you about. The results of the form for each category can be emailed to a different address. To use categories, click on:

  • (Drupal 7) - Administration > Structure > Contact form
  • (Drupal 6) - Administer > Site building > Contact form

For example, email for the Sales Department might be given a category of "Sales." The email address that the form is sent to may be sales@mycompany.com. If you want a reply automatically sent to the person sending the contact email, you can specify that here. Don't worry if you don't know them all right away, you can come back and change this at any time. Click the "Submit button."

Now click on the "Settings" tab. Here you can limit how many contact emails an individual may send in an hour -- this helps limit spamming. You may also turn on personal contact forms here; this allows users to contact each other. Click on the "Save configuration" button.

Grant access permissions

In order to allow people to use this contact form, you will need to give them permissions to do so.

Click Administer > User management > Access control (in D6 Administer > User management > Permissions or in D7 Administration > People > Permissions), locate the "Contact module" entry and enable it for the roles that will use Contact. Save your changes. The menu link (next step) will not be visible to anyone not having access.

Add "Contact" to the menu

Add the contact form to the menu is also easy. However there is on critical piece of information you will need and that is the relative page of the contact form. The relative path for the site wide contact form is contact (yes, it is simply contact). To add the site wide contact form to the main menu, you click on:

  • (Drupal 7) - Administration > Structure > Menus
  • (Drupal 6) - Administer > Site building > Menus

You can add a 'Contact' menu item as described in the Working with Menus section. Remember, the relative path for the site wide contact form in D7 is "contact"

Using it in content

To add a link to a content page use <a href="/contact">Contact Us</a>.

Need a customized contact form? Check the WebForm, Contact Forms or CCK modules.

Contact form spam

If you find you're getting spam emails through your contact form, check out Mollom,
Gotcha module or use the Captcha module.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

Helln’s picture

I was able to add the link to the contact form, but I would prefer that, when people click on my Contact Us Primary Link, it would go directly to the form and not a link to a form... How do I do this... Thanks for the info in advance!

hhotechstore’s picture

Go to admin/sitebuilding/menu/primary links.
Then add or edit "CONTACTS" menu.
Under "path", type the path that leads to the contact form: "contact" or "/contact".
That should do it.

rehan.3690’s picture

I am newbie to drupal.
i have created two categories called "Fruits" and "Vegitables" now how can i link the contact form in naviagtion menu as well as in main menu such that "Fruits" category should be default in navigation menu and "Vegitables" in main menu.
I am using Drupal 7
Plz help
Thnks in advance

NancyDru’s picture

I haven't tried it in D7 yet, but try "contact/fruits" and "contact/vegetables".

studiozut’s picture

I have the same question (Drupal 7), I'd like to link to the contact form with the option to preselect categories. Using the above example, /contact/fruits or /contact/vegetables is not working, neither is /contact?category=fruit or /contact/category/fruit.

johnhanley’s picture

This is an old post, but here's how to set the default category on the contact form page.

The name of the contact form category select field is 'cid'. The option values are numbered. So if you want to set the category to '2', pass a name/value pair in your link:

<a href="contact?cid=2">contact</a>

Then add a hook_form_alter in a custom module:

/**
 * Implementation of hook_form_FORM_ID_alter()
 */
function custom_form_contact_site_form_alter(&$form, &$form_state) {
  if (isset($_GET['cid']) && isset($form['cid'])) {
    $form['cid']['#default_value'] = $_GET['cid'];
  }
}
texas-bronius’s picture

Thanks @johnhanley. And to set by category name instead of cid value, this works:

  if (isset($_GET['category'])) {
    $key = array_search($_GET['category'], $form['cid']['#options']);
    if ($key !== FALSE && isset($form['cid'])) {
      $form['cid']['#default_value'] = $key;
    }
  }

which allows your links to look like contact?category=Photography

--
http://drupaltees.com
80s themed Drupal T-Shirts

marcmarc_’s picture

I can't seem to find the "Settings" tab at Administration > Structure > Contact form in Drupal 7
Am I blind ? or isn't this available in Drupal 7 ?

I did everything you explained, and still the contact form isn't showing ...

NancyDru’s picture

Yes, it's there in D7. If you use the Admin_Menu module, you may have to flush the cache after enabling the module or it may not show in the menu.

TIP: The modules admin page often includes a "Configure" link for modules.

colinawright’s picture

I also am having trouble adding a contact form. I appear to have created a form called "Contact" but can't find how to adjust its settings or find the form in site contents and thus can't add it to a menu, page or block. What am I not understanding? Is there a tutorial available?

cbh’s picture

Same problem here - I have settings carried forward from the D6 installation, but can't find any way to edit them here.

NancyDru’s picture

admin/structure/contact

Tony-Mac’s picture

No settings possibility. Restarted everything. Was someone successful with this?
Thanks
Tony

NancyDru’s picture

Make sure you have permission unless you are user/1.

colbtron’s picture

Remember to make it available to all users in the module/contact/permissions page. By default my contact form was only for admins. You can't change the contact fields in the built-in form without editing a .php file.

pickEpics’s picture

The only link for settings in my instance of D7, logged in as the administrator using the administration module and toolbar is under the Appearance drop down, no matter how many times I flush all caches and whether I get there by Modules/Contact/Configure or Structure/Contact form. My server is Debian-6 and my browser is FF on SL-6.3. Please try it in D7 NancyDru. Then if you find it, please tell us all where it is.

pickEpics’s picture

D7 only. I found the url given above didn't work. I'm not sure if this is syntactically correct but it does work:
<a href="/?q=contact">Contact Us</a>

NancyDru’s picture

I just tried it in a fairly clean install with Admin_Menu, and I find the settings form at "admin/structure/contact" and the actual contact form at "contact". And once I enabled the Navigation menu item, the Contact item showed up there.

Despairing’s picture

Using drupal 6.28 on two sites

One site sends form when logged in as administrator, not as ordinary user, nor anonymous
The other does not send anything... anymore, because before upgrading to 6.28 from, I don't know, possibly 6.12 (I left Drupal aside for several years because it only gave me troubles, headaches, deception and not once a real solution to my problems), I did even receive emails from anonymous users before that, actually... spam, even if I was using captcha :( the reason to never have opened any of several websites to the public, and thus, useless, abandoned and blocked all additional inspirations. However, giving another try I now find the contrary problem...

So could somebody help me solve this issue to this fundamental element in Drupal's core and maybe help me regain a minimum of confidence in Drupal?
Access to site-wide contact form for all users in both sites, obviously.
I don't know what other "secret" configuration should be needed to have something as simple and as fundamental as a form, just working!
Oh on top of all, after hitting the send button, Drupal sarcastically informs that "the message has been sent" even if it hasn't. :p

garisonWebDesign’s picture

Is it possible to add content to the contact form? Some instructions, perhaps? Or could the contact form be embedded in a regular content page?

studiozut’s picture

I add content by creating blocks and setting them to appear in 'content top' etc on the specific page 'contact', if that helps

jerome72’s picture

Thank you ! I also was wondering why I didn't find the config settings page for the contact form. It's different from drupal 6, and your solution is the way to go.

AdrianNEWINGTON’s picture

Hi,
I managed to get my contact page up on my dev localhost drupal 7 site (PushTape Distro).
I've correctly setup the recipient email address as my own.
But I'm not sure if I need to do something else to actually send the message as an email to me.
I've checked my gMail inbox but nothing has arrived.

Is there some settings to do with email servers?
Thanks

srikanth.g’s picture

I have to create a 'feedback/suggestions/Grievances' form to capture mandatory fields - name, email id, mobile no., drop-down type of complaint including 'others' option, complaint of 100 characters. After submit, the user should get an id number as an instant pop-up as well as the complaint number and complaint should go to complainants email.
To add extra fields i am using Contact form fields module: https://www.drupal.org/project/contact_field
But how to get/mail the complaint number to the user?

conifer.club’s picture

hey So somehow I changed the text color to white ( not the greatest color) and was wondering if anyone knew how to change it back to black

Bhaskar J’s picture

Unable to receive mail from contact form

home tuitions in hyderabad’s picture

i am also unable to receive mail please send me any solution

home tuitions in hyderabad