Multipe Email Recipients with Webform

Tags: Drupal, Webform, Email.

Through the Drupal Webform configuration you can specify multiple To addresses but not Cc or Bcc. Webform works by sending a separate email to each To address. For a single email to multiple people, you can add THEME_webform_mail_headers() to your template.php as shown below.

You also have access to $node (node object for the webform) and $submission (webform submission of the user) if you need to add additional processing.

function THEME_webform_mail_headers($variables) {
  $headers = array();

  //watchdog('debug', '<pre>'. print_r($variables['node'], TRUE) .'</pre>');
  //$headers['X-Mailer'] => 'Drupal Webform (PHP/' . phpversion() . ')');

  if ($variables['node']->nid == '1234') {
    $headers['cc'] = 'person1@example.com,person2@example.com';
    $headers['bcc'] = 'person3@example.com';
  }

  return $headers;
}