<?PHP
if(isset($_GET('mail'])) && count($_POST) > 0) {
$your_email = "[email protected]";
$name = $_POST['name'];
$email = $_POST['email'];
$feedback = $_POST['feedback'];
$body = "Feedback sent by $name";
$body .= "<hr />";
$body .= htmlspecialchars($feedback);
$body .= "<hr />";
$body .= "Sent at ".date("d/m/Y H:i", time())." IP: ".$_SERVER['REMOTE_ADDR'];
$header = "Content-Type: text/html\r\nReply-To: $your_email";
if(mail($your_email, "New feedback", $body, $header))
die("Feedback sent");
else
die("Failed to send email");
}
?>
<form method="post" action="index.php?mail=1">
<p>Your name:<br /><input type="text" name="name"></p>
<p>Your email:<br /><input type="text" name="email"></p>
<p>Your feedback:<br /><textarea name="feedback"></textarea></p>
<p> </p>
<p><input type="submit" value="Send feedback"></p>
</form>
Comments