Contributions API

theme_webform_mail_message

Definition

theme_webform_mail_message($form_values, $node, $sid, $cid)
contributions/webform/webform.module, line 1721

Description

Theme the contents of e-mails sent by webform.

Parameters

$form_values An array of all form values submitted by the user. The array contains three keys containing the following:

$node The complete node object for the webform.

$sid The submission ID of the new submission.

$cid If you desire to make different e-mails depending on the recipient, you can check this component ID to output different content. This will be the ID of the component that is a conditional e-mail recipient. For the normal e-mails, it will have the value of 'default'.

Code

<?php
function theme_webform_mail_message($form_values, $node, $sid, $cid) {
  global $user;

  $message = '';
  $message .=  t('Submitted on') .' '. format_date(time(), 'small') ."\n";
  $ip_address = ip_address();

  if ($user->uid) {
    $message .= t('Submitted by user') .": $user->name [$ip_address]\n";
  }
  else {
    $message .= t('Submitted by anonymous user') .": [$ip_address]\n";
  }

  $message .= "\n";
  $message .= t('Submitted values are');
  $message .= theme('webform_mail_fields', 0, $form_values['submitted_tree'], $node);

  $message .= "\n\n";
  $message .= t("The results of this submission may be viewed at:") ."\n";
  $message .= url('node/'. $node->nid, array('query' => "sid=". $sid, 'html' => TRUE));

  return $message;
}
?>