I've currently set up a webform which will send a customer's email to myself and a third party. The email includes the values of a few fields such as one labelled 'message'. In the email I see something like

Message: The Customer's Message

I would like to be able to either remove or modify the text of 'Message'. Is this possible? I'm guessing that the webform_mail_fields them function would be of help, but I'm not how to achieve this.

Also, is there any way of adding some default text to the top of the email other than adding the contents of a hidden text field to the email.

Essentially I'd like to end up with something like:

Message sent via my website:

Customer's message

Any help would be greatly appreciated.

Comments

quicksketch’s picture

Read the THEMING.txt file included with Webform, that should get you started.

RichieRich’s picture

Thanks quicksketch. That got me as far as removing the stuff which I didn't want from the email via a custom tpl.php file which I've themed. I'll take another look though.

RichieRich’s picture

So, I'm writing variables the email as per the suggestion in the readme file. This part seems to be of interest:

[submitted_tree] => Array
(
[email] => emailaddress
[confirm_email] => emailaddress
[message] => Customer's messsage
[message_header] => Email sent via mywebsite
)

So, the variable names are being used as the array keys, but where are the labels which are used in the email being stored and how can I override or remove them? Sorry if this is a rather simple question but as you've probably gathered my experience of theming is relatively limited in this respect.

I wonder if I finally require the Devel module for this....

quicksketch’s picture

The labels are actually stored as part of the component configuration (in the node). I don't provide specific help on writing custom code in the issue queue. This feature request is probably of interest to you though: #310195: Make field labels optional.

RichieRich’s picture

Thanks quicksketch. I still want the labels on the form, but I'd like to remove them from the email and / or be able to change them.

Naturally I'd still like 'Message' to appear next to textarea on my webform, but when the email is sent to a client I have no need for 'Message' to appear in the email.

Also, on the webform I'd like to have a filed called 'Your Name' which is replaced by 'Customer's Name' in the email.

I'm not sure if this is even possible. I'll take a look at the link which you've provided.

quicksketch’s picture

Status: Active » Closed (fixed)

Closing after lack of activity. I should note in the 3.x version, we have theme_webform_element() which can be used to change the display of labels.