Last updated September 21, 2016. Created on May 9, 2005.
Edited by HongPong, sockeye, rgon, mgosur. Log in to edit this page.

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 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
    • In Drupal 8: Menu > Extend or http://example.com/admin/modules
    • In Drupal 7: Administration > Modules or http://example.com/admin/modules
    • In Drupal 6: Administer > Site building > Modules or http://example.com/admin/build/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. (Administration > Structure > Contact or http://example.com/admin/structure/contact in Drupal 7; Administer > Site building > Contact form or http://example.com/admin/build/contact in Drupal 6).
  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".
  • In Drupal 6, you can specify further settings:

    1. Navigate to the Contact Form settings page (http://example.com/admin/build/contact/settings)
    2. In the "Additional Information" section, enter the text to display with the contact form.
    3. In the "Hourly Threshold" list, select the maximum number of submissions that a user can make per hour.

    Configure the user Contact form

    1. Navigate to the Account Settings page (Administration > Configuration > People > Accounts or http://example.com/admin/config/people/accounts in Drupal 7; Administer > Site building > Contact form > Settings or http://example.com/admin/build/contact/settings in Drupal 6).
    2. In D6, in the Contact settings section, specify whether the contact form is enabled for users by default. Changing this form does not affect existing users. In D7 this option is in the Account Settings page
    3. Click "Save configuration."

    Controlling repeat submission blocking (flood control) in Drupal 8

    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.

    Permissions

    Drupal 7

    1. Navigate to the Permissions page (Administration > People > Permissions or http://example.com/admin/people/permissions).
    2. In the Contact section, specify whether a user role has the following permissions:
      • Administer contact forms and contact settings: Only administrators should be granted this permission.
      • Use the site wide contact form: Users with this permission can send messages to specific addresses that you specify.
      • Use users' personal contact forms: Users with this permission can send messages to any authenticated user who has enabled the contact form in their user settings. Granting this permission to unauthenticated users may not be desirable.
    3. Click "Save Permissions."

    Drupal 6

    1. Navigate to the Permissions page (Administer > User management > Permissions or http://example.com/admin/user/permissions).
    2. In the Contact section, specify whether a user role has the following permissions:
      • Access Site Wide Contact Form: Users with this permission can send messages to specific addresses that you specify.
      • Administer Site Wide Contact Form: Only administrators should be granted this permission.
    3. Click "Save Permissions."

    Menu link

    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 an 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. See Working with blocks (content in regions)

    Module development

    How can you get involved?

    Maintainer

    The current maintainer of core's Contact module is Dave Reid.

    AttachmentSize
    Screencap of a contact form.41.78 KB

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

    Comments

    calbasi’s picture

    I'd like a web has a site-wide contact form, but I don't want user can enable their personal contact forms.

    Is it possible?

    Regards

    www.calbasi.net
    Ps: If you can not understand me, it's my poor English skills fault :-p

    liquidcms’s picture

    i haven't seen this either yet.. but seems like a pretty obvious use case

    lororey’s picture

    Hello!
    if you only need to set up a contact form on your website for all visitors regardless of registered or anonymous users and do not want authenticated users to enable their personal contact form -----on Drupal 7--- Just go to admin/people >>on permissions tab<< scroll down to CONTACT section and you will see three (3) options on left side as shown bellow: (if you do not see any contact items there - you need to enable the contact module on the drupal CORE modules section at admin/modules/ core section and check "contact" then save configuration and you will see the following bellow:

    Contact
    Administer contact forms and contact form settings

    Use the site-wide contact form

    Use users' personal contact forms

    On the right site there are permission check boxes for
    [anonymous user]
    [authenticated user]
    [administrator]

    Just check all three boxes for the *****Use the site-wide contact form***** row and you are done. just save changes.

    if you setup permissions for the [anonymous user] it is a must to install and enable a module for Preventing contact spam e-mails as noted on Drupal documentation that says: "there are lots of good spam-prevention modules that easily integrate and protect the contact forms and other forms (like comments, nodes, etc)." visit this link: http://drupal.org/node/206787

    NOW to enable the contact form to appear as a main menu on top of your website like: home***about***products***CONTACT*** and so on;
    on Drupal 7 go to Admin/structure/menus under --navigation-- section click on [LIST LINKS] operation and enable the [contact menu] which is disable by default on Drupal core - Save configuration and visit your Site's Front page on another Browser to tested. Contact menu link will work but is located on the navigation block. IF YOU NEED this Contact Menu to appear on top of your site along with the others menus Visit the admin/structure/menus under Navigation section click on LIST LINKS again and on CONTACT MENU row click on edit and make it disappear from [NAVIGATION] block and appear as Primary Link which are now called [MAIN MENU] on Drupal 7.
    Have Fun with Drupal 7!
    Regards.
    Lorenzo

    petu’s picture

    Thank you very much for this description in particular!
    Is there possibility to insert contact form as a block at another page?

    petu’s picture

    Here is the answer on my question: http://drupal.org/project/formblock
    It adds a block for contact form.
    Also Drupal 7 supported.

    rehan.3690’s picture

    I could use the contact form as block but the problem is getting overlapped with the content in the page
    I put the block left side, below the navigation menu.

    user_of_drupal’s picture

    Thanks for the main menu contact form tip, just what I needed.

    aneeshaider’s picture

    Hi,

    I am using site-wide contact Us form, but when user click "send email" submit button, the workflow automatically take the user to home page, without showing any sort of message, which could be very inconvenient for end user.

    But in case user did not supply subject or other mistake, than it is properly reported. How can we show 'message successfully submitted' message?

    Also, how can we change "send email" submit button text to "send message"?

    Thank you.

    vincent.wasteels’s picture

    Hello

    I've a bilingual site with drupal7, I use the contact form, and output its link in the main menu,
    it says "This string will be localizable. You can translate it using the translate interface pages." for the title, but I can't find it in the translate interface, am I doing something wrong ?

    thank you !!

    UPDATE : the link is in the translate interface, I translated it, but it still keep showing in default language... any idea ??

    scottiedude’s picture

    I've been having problems displaying a contact form on my page. I've followed the instructions above up until the part where it says to go to 'Structure' ... I cannot find contact form anywhere. Anyone else came across this problem? Help appreciated. Thanks!

    bensoi’s picture

    hi scottiedude! have you resolved this problem? ive encountered quite the same thing. i followed the instructions above but instead of finding Contact under Structure, i found it in the Administration menu bar at the top of the page with a label of "Contact form". using the drag-and-drop feature in the Administration/Structure/Menus/Management, i was able to put it under Structure.

    now, i've read this line from the config page of the Contact form

    A Contact menu item (disabled by default) is added to the Navigation menu, which you can modify on the Menus administration page.

    i tried to look for the said menu item under Navigation but found none and i can't find any contact form in the site. i also tried to put the Navigation block in a specific region but it didn't make any changes.

    any advice? and btw, im using D7. thanks!

    bensoi’s picture

    hi scottiedude! have you resolved this problem? ive encountered quite the same thing. i followed the instructions above but instead of finding Contact under Structure, i found it in the Administration menu bar at the top of the page with a label of "Contact form". using the drag-and-drop feature in the Administration/Structure/Menus/Management, i was able to put it under Structure.

    now, i've read this line from the config page of the Contact form

    A Contact menu item (disabled by default) is added to the Navigation menu, which you can modify on the Menus administration page.

    i tried to look for the said menu item under Navigation but found none and i can't find any contact form in the site. i also tried to put the Navigation block in a specific region but it didn't make any changes.

    any advice? and btw, im using D7. thanks!

    akhey’s picture

    what i did was, i added the contact node in the main menu by putting "contact" as the link. HIH

    leroysteinbacher’s picture

    In Drupal 7 I enabled the contact module and set the permissions but I also can't find the contact form anywhere.

    I discovered that if I cleared the cache and changed the admin theme the new stuff shows up.

    droopie32’s picture

    I didn't realize when I added a site-wide contact form, that individuals would have a link as well. Is it possible to retrieve messages that were sent directly to a users email? In other words, is the content of a contact form stored anywhere on the system?

    thanks

    manu.joseph’s picture

    subscribing

    nomad-drupal’s picture

    Maintaining several sites using separate 6.22 Drupal installs, only one drupal install has recently gone into a glitch where saving the contact form text in /admin/build/contact/settings generates a 404 (not found) at apache level. The other similar drupal installs behave correctly in this matter.

    I've gone through several hoops to try and get rid of this error - to no avail. I've disabled/enabled the contact module, deleted category etc. The 404 keeps appearing - also when i try to change the hourly threshold or change the "Enable personal contact form by default" option.

    Checked .htaccess, which seems ok - the other pages all work well. Clean URLs work allover the site.

    Drupal permissions are set correctly - at file level the contact module has the correct file permissions. Similar to the other 6.22 Drupal installs. I've rebuild permissions at Drupal level, checked the database using PHPmyadmin etc. All seems ok.

    Somehow the path translation is somehow messed up. When the save "configuration button" is pressed resulting in this code

    form action="/SUBDIR/admin/build/contact/settings" accept-charset="UTF-8" method="post" id="contact-admin-settings"

    I get the APACHE 404 error.

    Clearing cache and disabling performance options doesn't help either.

    how can i pinpoint and solve this problem?

    Thx!
    Nomad

    nomad-drupal’s picture

    For anyone bending over backwards in the future to solve a similar problem with the contact form text. In my case I got around this problem by reversing my edits in the form text field below from:

    <p>You can leave a message using the contact form below.</p>"
    <p class="rtecenter"><a href="http://twitter.com/SomeUSER" target="_blank"><img src="http://www.mysite.com/SUBIR/sites/default/files/follow_me-c_0.png" alt="Follow SomeUSER at Twitter" /></a><br />
    &nbsp;</p>
    

    to the standard text again like:

    <p>You can leave a message using the contact form below.</p>
    

    I don't know yet what part of the above text causes the 404 error.

    FCKeditior 6.x-1.4 was loaded to edit the form text field.

    In a previous Drupal (several upgrades ago) release the form text (with twitter link) was saved without a problem.

    nomad-drupal’s picture

    The 404 turns out to be a 403 (forbidden) and is
    caused by a mod security config at the server.

    Had nothing to do with Drupal.

    POST statements are filtered and in thus
    isolated case the mod security filter trips a 403.

    Read about it here

    http://drupal.org/node/110219

    bezu60’s picture

    How can I add word wrap to the Contact Form?

    Thanks,

    Beth

    migala’s picture

    In D6 we can specify a text to be displayed with the contact in the "Additional Information" section.
    I can't find any similar option in D7.

    Is this possible?

    Thanks.

    migala’s picture

    1) Create a block with the info you want to display.
    2) Configure the block to appear before (or after) the main content block.
    3) Show it only in the contact page.

    HIH

    mgifford’s picture

    There are instructions for how to edit the threshold list for users on an hourly basis above for D6:

    In the "Hourly Threshold" list, select the maximum number of submissions that a user can make per hour.

    But, how do we do this in D7? As mentioned, the links have changed. But I'm not even sure that the functionality was ported over.

    andes1’s picture

    For Drupal 7, where do i get settings to change the No of mail limit per hour ?

    pitxels’s picture

    klakin’s picture

    My contact form (d6) is not including the user's email address in the message it sends to me. Any idea how I can get it to do this? Seems like an important bit of information if you actually want to respond to the person...

    migala’s picture

    This info is sent in the e-mail like "from" header field, so you can simply reply the mail.

    HIH

    klakin’s picture

    Now that works. I was trying to send through gmail and they change the "FROM" header, so it wasn't working. Thanks for the help.
    If anyone else has this problem use this postfix setup instead of gmail:
    http://www.rackspace.com/knowledge_center/index.php/Postfix_-_Installation

    johnnycho’s picture

    On the site-wide contact form, are we stuck with just the word "Contact" for the page title (both in the browser title bar and under the main menu)? I can't seem to figure out where to go to change "Contact" to say, for instance, "Contact Us" or "Give Us Your Feedback" or some other custom text. Any assistance would be appreciated!

    strin’s picture

    Hey JohnnyCho - did you ever get a solution for this, as I've got the same query and can't figure out where to change the form title when displayed? I'm guessing it's either in contact.module, or contact.admin.inc, but my head is sore from banging...
    Thanks

    ericg818’s picture

    Is there a way for users to be able to send each other messages that include a file attachment? Thank you.

    thoughtpublishing’s picture

    I've enabled the contact form for my site at http://microclinics.org/contact. When I click Send message, I'm taken to the homepage with a message saying "Your message has been sent." However, nothing is actually sent to the email addresses I've specified. Do you have any recommendations on what the issue could be?

    I've checked the spam for the inboxes the message should be sent to and I've tried sending and receiving from multiple email addresses, but the contact form isn't working. In Drupal, I've enabled the site-wide contact form and followed the recommended settings in the article above.

    Snur’s picture

    I have added a Contact us form with my main email address as a recipient address.
    https://www.afab-lab.com/dr/contact

    The Contact form does not send email to my main email address but shows "Your message has been sent." message.

    If I activate auto-reply option, then I receive the auto-reply message to the email address I fill in the contact form.

    The web site is hosted on GoDaddy.

    What am I missing?

    Thank you.

    Daniel Schaefer’s picture

    Hi
    I rewrite the user page using Views. I have a link connected to the user contact form in my view. Of course, this link should not be shown when the user disabled his personal contact form. Does anyone have an idea how to solve this? Couldn't find a Views filter/relationship/permission setting etc. to find this out. Please help.
    Thanks!

    Daniel Schaefer’s picture

    Worked it out via Views. Latest release brought "link to contact page" back in.
    If there are other ways to achieve this, let me know.

    jackbgarvey’s picture

    I accidentally removed the text from the Contact Form Redirect field in the "Contact Form Settings page"

    http://www.lrsd.org/drupal/#overlay=%3Fq%3Dadmin%252Fstructure%252Fconta...

    Now my contact form will not display.

    Can anyone help me out?

    I've researched Bing and can't find the information I need. (My computer can't access Google right now)

    Thank you to anyone who has the time...

    FrontBurner’s picture

    Our company has recently outsourced our email needs to a 3rd party and our contact form no longer works. The reason for this is our smtp server requires the email sender to be the same as the account that we authenticated with . For instance if we authenticate against the smtp server with the username "notifications" then any email sent through that session must be sent on behalf of notifications@mysite.com. The drupal contact form is using the contacters email address as the sender which is blowing everything up. Is there an easy solution to this?

    nunners’s picture

    I have the same issue - in the contact form recipients list, i have the following email address.... 123abc@yahoo.com (not this exact email address, but one that exists on yahoo and i use all the time)

    On the contact form, i enter...

    your name - TestPerson
    your email address - 456def@yahoo.com (not this exact email address, but another i know exists and works...)
    subject - Test Subject
    message - Test Message

    After i press send, i get one failure message and one success.

    The successful message gets sent to 456def@yahoo.com stating a "thank you for contracting my website etc" (from 123abc@yahoo.com as i set this up as the admin email address).....

    The failure is found in the recent log message stating... Error sending e-mail (from 456def@yahoo.com to 123abc@yahoo.com).

    My question is why would this try to send an email from the address I have just entered on the contact form? this seems wrong to me?

    thanks Matt

    Tal Aviel’s picture

    I've installed drupal 7. I have a site with two languages: Hebrew (default) & English.
    When a user submits a contact form in Hebrew (default language) everything works, but when he tries to send the same contact form in English the "error sending e-mail" message appears.
    When can I do to fix this issue?

    Thank you !
    Tal Aviel

    uxicorp’s picture

    I have this configured in Drupal 7. When a user fills out contact form, an alert is dispatched through email. Here's what the email looks like:

    Hello User123,
    admin (http://mysite.com/users/admin) has sent you a message via your contact form (http://mysite.com/user/25/contact) at My Site.
    If you don't want to receive such e-mails, you can change your settings at http://mysite.com/user/25/edit.

    Message:
    fasdfasdf

    How do I get the message to show up in the user's Messages on the site itself so it's not just sent through email?

    shinapardilla’s picture

    "Unable to send e-mail. Contact the site administrator if the problem persists ",
    i want to test my contact form but problem quoted below exists .is anybody could help me to resolve this?

    robbielink’s picture

    Is there a way to have the auto-reply use a different email address to send from other than the one specified as the admin email? I would like to use a do-not-reply@websitename address for auto-reply so the sender does not have my email address until I actually reply in person. How can I set this?

    strin’s picture

    Hey JohnnyCho - did you ever get a solution for this, as I've got the same query and can't figure out where to change the form title when displayed?
    Thanks

    zorbtrauts’s picture

    I just ran into this issue. Create a menu item for the contact form (setting the path accurately) and give it the title you want the form to have. Go ahead and disable the menu item. I've found that this is changing the contact page title for me. I'm not entirely sure why.

    onitrebla’s picture

    people we can do this way i found this examples in the internet:

    function YOURTHEME_form_contact_site_form_alter(&$form, &$form_state) {
    drupal_set_title('ADD YOUR TEXT HERE');
    }

    olecarme’s picture

    When I write an auto-reply message in HTML with embedded links using the "a" tag, the message is edited by Drupal. I cannot choose the layout I wish, and links are rewritten as footnotes. The result is not very pleasant in my opinion, and I would like to be able towrite the message in full HTML, without any change allowed to it when it's send to the user who send a mail using the contact page.

    Is it possible?

    usmanjutt84’s picture

    I'm using Drupal 7.43 on localhost when I enable contact module from Modules>Contact and save it but contact form is not showing at such link http://localhost/drupalWeb/contact.
    Am I doing something wrong?

    raghvendragupta80’s picture

    This is a hook_form_contact_message_feedback_form_alter.you will use when you want theme of contact form in drupal 8 . this is same theming like drupal 7.but here you need to create a [THEMENAME].theme file in your theme folder
    /***************--Hook Implementation--***************/
    function [THEMENAME]_form_contact_message_feedback_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

    // Name
    $form['name']['#prefix'] = '

    ';
    $form['name']['#suffix'] = '

    ';
    $form['name']['#attributes']['placeholder'][] = $form['name']['#title'].'*';
    $form['name']['#attributes']['class'][] = 'form-control';
    unset($form['name']['#title']);

    // Mail
    $form['mail']['#prefix'] = '

    ';
    $form['mail']['#suffix'] = '

    ';
    $form['mail']['#attributes']['placeholder'][] = $form['mail']['#title'].'*';
    $form['mail']['#attributes']['class'][] = 'form-control';
    unset($form['mail']['#title']);

    // Subject
    $form['subject']['widget'][0]['value']['#attributes']['class'][] = 'form-control';
    $form['subject']['widget'][0]['value']['#attributes']['placeholder'][] = $form['subject']['widget'][0]['#title'].'*';
    $form['subject']['widget'][0]['#title'] = '';
    unset($form['subject']['widget'][0]['value']['#title']);
    $form['subject']['widget'][0]['#prefix'] = '

    ';
    $form['subject']['widget'][0]['#suffix'] = '

    ';

    // Message
    $form['message']['widget'][0]['value']['#attributes']['class'][] = 'form-control';
    $form['message']['widget'][0]['value']['#attributes']['placeholder'][] = $form['message']['widget'][0]['#title'].'*';
    $form['message']['widget'][0]['#title'] = '';
    unset($form['message']['widget'][0]['value']['#title']);
    $form['message']['widget'][0]['#prefix'] = '

    ';
    $form['message']['widget'][0]['#suffix'] = '

    ';

    // Submit
    $form['actions']['#prefix'] = '

    ';
    $form['actions']['#suffix'] = '

    ';
    $form['actions']['submit']['#attributes']['class'][] = 'btn';
    $form['actions']['submit']['#attributes']['class'][] = 'btn-success';
    $form['actions']['submit']['#attributes']['class'][] = 'pull-right';

    }