I noticed on a test run that the keys were not being grabbed.
What was happening was when the body was written, it would overwrite everything else since it was a straight variable assignment instead of an append.
Specifically:

function form_mail_send_email($edit) {
  unset($edit["op"]);
  foreach ($edit as $key => $value) {
    if ($key == "to" && variable_get("form_mail_custom_to", 0)) {
      $to = $value;
    }
    elseif ($key == "body") {
      $body = $value;
      break;
    }
    else {
      $body .= "$key: $value\n";
    }
  }

should be...

function form_mail_send_email($edit) {
  unset($edit["op"]);
  foreach ($edit as $key => $value) {
    if ($key == "to" && variable_get("form_mail_custom_to", 0)) {
      $to = $value;
    }
    elseif ($key == "body") {
      $body .= $value;
      break;
    }
    else {
      $body .= "$key: $value\n";
    }
  }

N.B. the $body .= $value;

Hope this helps someone.

-J

Comments

Anonymous’s picture