$value) { // assign to temporary variable and strip whitespace if not an array $temp = is_array($value) ? $value : trim($value); // if empty and required, add to $missing array if (empty($temp) && in_array($key, $required)) { array_push($missing, $key); } // otherwise, assign to a variable of the same name as $key elseif (in_array($key, $expected)) { ${$key} = $temp; } } } // validate the email address if (!empty($email)) { // regex to ensure no illegal characters in email address $checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/'; // reject the email address if it doesn't match if (!preg_match($checkEmail, $email)) { array_push($missing, 'email'); } } // go ahead only if not suspect and all required fields OK if (!$suspect && empty($missing)) { // build the message $message = "\nContact WMU News message submission\n\n"; $message .= "Name: $name\n"; $message .= "E-mail: $email\n"; $message .= "SUBJECT: $title\n\n"; $message .= "$comments\n\n\n"; $message .= "- - -\n\n"; $message .= "This message was generated from the \"Contact WMU News\" form at: http://www.wmich.edu/wmu/news/contact/\n\n"; // limit line length to 70 characters $message = wordwrap($message, 120); // create additional headers $additionalHeaders = "From: $name <$email>"; if (!empty($email)) { $additionalHeaders .= "\r\nReply-To: $email"; } // send it $mailSent = mail($to, $subject, $message, $additionalHeaders); if ($mailSent) { // $missing is no longer needed if the email is sent, so unset it unset($missing); } } } ?>

|
By Phone Alumni Association Main Number: (269) 387-8777 Main Fax: (269) 387-8770 |
By Mail Mailing Address: WMU Alumni Association 1903 West Michigan Avenue Western Michigan University Kalamazoo, MI 49008-5404 |
Required fields are marked in bold.
Please complete the missing item(s) indicated.
Sorry, there was a problem sending your message. Please try later.
Your message has been sent. Thank you for your feedback.