I'm trying to alter the output of webform submissions in emails. At the moment, I'm just looking for the correct function. I can see there is a hook to alter the rendered output, which is being hit, but it is not changing the output of the emails. Am I replacing the Theme function in the correct place?

function seven_webform_submission_render_alter(&$renderable) {
  $renderable['#theme'] = 'seven_webform_submission_table';

function  seven_webform_submission_table($node, $submission, $email, $format) {
  return 'test';
  • there is little confusion about query. what u actually want? – monymirza Mar 26 '13 at 5:24

The hook you are looking for is hook_mail_alter.

To modify webform submissions emails your code should look like:

function MYMODULE_mail_alter(&$message){
  if ($message['module'] == 'webform' && $message['key' == 'submission']){
    /*** Place your code here ***/

This will alter just the webform submissions emails.

  • 1
    Your code is wrong wrongly formated, this is how it should look. function MYMODULE_custom_mail_alter(&$message){ if ($message['module'] == 'webform' && $message['key'] == 'submission'){ dpm($message); } } – Marko Blazekovic Sep 15 '13 at 11:48

Read Documentation here that may help you.

Customising the emails sent by webform

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy