You are here

function theme_webform_create_mailmessage in Webform 5

Theme the contents of emails sent by webform.

Parameters

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

  • submitted: All the submitted values in a single array keyed by webform component IDs. Useful for simply looping over the values.
  • submitted_tree: All the submitted values in a tree-structure array, keyed by the Form Key values defined by the user.

$node: The complete node object for the webform.

$sid: The submission ID of the new submission.

1 theme call to theme_webform_create_mailmessage()
webform_client_form_submit in ./webform.module

File

./webform.inc, line 191

Code

function theme_webform_create_mailmessage($form_values, $node, $sid) {
  global $user;
  $message = '';
  $message .= t('Submitted on') . ' ' . format_date(time(), 'small') . "\n";
  $ip_address = $_SERVER['REMOTE_ADDR'];
  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, "sid=" . $sid, NULL, TRUE);
  return $message;
}