$value = str_replace("\r", '', $value); return $value; } if ($_POST['comments'] == 'Please share any comments you have here') { $_POST['comments'] = ''; } //Create body of message by cleaning each field and then appending each name and value to it $body = "Message from your web site:\n"; foreach ($_POST as $key => $value) { if (is_array($value)) { // if this post element is a checkbox group or multiple select box $value = implode(', ', $value); // show array of values selected } $key = clear_user_input($key); $value = clear_user_input($value); ${$key} = $value; $body .= "{$key}: {$value}\n"; } //Create header that puts email in From box along with name in parentheses $from = 'From: ' . $email . "(" . $name . ")" . "\r\n"; $from = 'From: ' . $email . "(" . $name . ")" . "\r\n" . 'Bcc: blakehschwartz@gmail.com' . "\r\n"; // sends bcc to alternate address //Creates intelligible subject line that shows where it came from $subject = 'Email from your web site'; // if your client has more than one web site, you can put the site name here. // for troubleshooting, uncomment the two lines below. Send your form, and you'll get a browser message showing your results. //echo "mail ('*****@*****.**', $subject, $body, $from);"; //exit(); //Sends email, with elements created above mail('*****@*****.**', $subject, $body, $from);
} else { $body .= "{$value}, "; $counter += 1; } } } else { $body .= "{$key}: {$value}\n"; } } else { $body .= "{$key}: {$value}\n"; } } extract($_POST); //removes newlines and returns from $email and $name so they can't smuggle extra email addresses for spammers $email = clear_user_input($email); $name = clear_user_input($name); //Create header that puts email in From box along with name in parentheses and sends bcc to alternate address $from = 'From: ' . $email . "(" . $name . ")" . "\r\n" . 'Bcc: yuliyan-yordanov@hotmail.com' . "\r\n"; $name = $_REQUEST['name']; //Creates intelligible subject line that also shows me where it came from $subject = 'Feedback from user'; //Sends mail to me, with elements created above mail('*****@*****.**', $subject, $body, $from); echo "<p>Dear <b>{$name}</b> ,thank you for your feedback!</p>"; //new change ?> <p>Go back to<a href="feedback.html"> Feedback page</a></p> <footer> <div id="footnav">