Bohemian Blog

  1. About This Blog
  2. Archives
  3. Blog
  4. Home

Drupal Webform Module: How To Customize the Subject Line

I can’t seem to find a lot of documentation on certain Drupal modules. Yet another thing about Drupal that is frustrating, especially considering how much crap people throw at WordPress. WordPress seems to be much more organized and JUST as capable as Drupal. Oh well. Haters gonna hate.

THE FOLLOWING DESCRIBES HOW DRUPAL 6 WORKS.
THIS HAS CHANGED A BIT FOR DRUPAL 7.
(See comments for info about Drupal 7.)

How to customize the subject line in an automated email generated by the Drupal webform module

Sometimes examples save a lot of descriptive verbiage…

field label “First Name” – field key “fname” –
webform email custom subject line “Message from %value[fname]

and

field label “Last Name” – field key “lname” –
webform email custom subject line “Message from Mr. %value[lname]

unless the field in question is contained in a fieldset element! If that’s the case:

field label “First Name” – field key “fname” – fieldset field key “contact_info” –
webform email custom subject line “Message from %value[contact_info][fname]

and then click “Save e-mail settings” and you’re done!

This information was derived from the last comment on this page: http://drupal.org/node/823408 after 45 minutes of looking through a bunch of dead ends. I hope this post is easier to find, digest and get back to what you were doing before you forget why.

Mark Housel asks, “I was wondering if you could tell me just where these few lines go?”

So, the above details do take for granted that you know where the text in question should be input into the Drupal system. I generally try to avoid doing that. So many great how-tos on the web are written by smart people that seem to be talking to other people that already know a great deal about the subject in question. So we should all try to account for folks that are not familiar with certain details.

Mark and anybody else that is a little lost: I assume you know how to create a webform node on your Drupal site. If you click to edit the webform node in question you should see something like this:

  1. From the Webform node > edit window, click the “Webform” tab (see A)
  2. Click on the “E-mails” sub-tab (or section … whatever you want to call it … see B)
  3. If there is an existing E-mail output setup, click “Edit”. If one does not exist click “Add”

Following steps 1 thru 3 will bring you to the following page:

Scroll down to the “E-mail header details” and the “E-mail subject > Custom”. This is the input that I am referring to above. Enter what you need to there to alter the subject line of the automated email output.

Let me know if there are any other questions.