The Contact Module allows site visitors to send emails in Drupal 7 to other authenticated users and to the site administrator. Through personal contact forms, users can send each other 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.
Step 1: Make Sure the Contact Module Is Enabled on Your Drupal 7 Website
- Click Modules
- Click Save configuration.
Step 2: Â Go to Your Site URL
Navigate to the Contact Form page of your Drupal 7 site. Â http://example.com/contact
Step 3: Go to Structure
Now go to structure as follows.
Step 4: Â Add and Edit Categories
Click Add category to add a new one.
There is a default category called website feedback that you can use as well, but we are showing you how to add extra ones. You can edit the default category later if you need to.
Step 5: Â Configure the Category
- Give the category a name
- Specify the Recipients
- Create an Auto-reply message
Set Selected. Yes means it will be the default contact form. Since this is a new category, you probably want this to be No. You can only have one default.*
Be sure to click the Save button.
*Selected: When a visitor clicks on the link to the contact form, the categories will show in a drop down list. Whichever one is chosen with a “Yes” will show automatically. If you want your visitor to be forced to choose a category before submitting the form, make all of these fields “No”
Now it becomes as shown in the image below.
Now Contact Form looks like the image below.
Step 6: Add a Block With Instructions for the User
Go to Structure > Blocks.
Add a block.
Add the block information.
- Enter a Block Description. This will not be seen by the public.
- Enter a Block Title. This will be seen by the public.
- Write your instructions. This will also be visible to the public.
Scroll down the page.
Step 7: Â Set the Visibility Settings by Assigning It to the Contacts Page
- Choose “Only listed pages”. The only page we want to have these instructions is the Contact page.
- Write “contact” in the text field.
- Save the block.
Enable the block
Remember  to Save – scroll to the bottom of the page
No changes will be saved until you click Save blocks.
Your result should be as shown below.
Conclusion
While a contact form is a simple concept, it can be a bit complex to set up and operate. This tutorial on How To Send Email In Drupal 7 explained the features of site-wide contact form along with the drop down category for each of contact categories. I hope it was helpful. Feel free to leave a comment if you have any questions.
Also have a look on another blog post by us on, How To Install Varnish On Drupal 7?
Owais Alam
is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at [email protected]