<html>
<h1>Contact Me</h1>
<?php
if(isset($_POST['submitted'])){
if(($_POST['name']=="")||($_POST['mail'])=="")){
echo "Please fill out both fields !";
exit;
}
//add From: header
$headers = "From: " . $_POST['mail'] . "\r\n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
$body = "" . $_POST['name'] . " has requested to be e-mailed.";
//send message
mail("maxfxg@gmail.com", "Mail back request", $body, $headers);
echo "I will contact you shortly."
}
?>
<p>Fill out your name and e-mail address in the form below and I will contact you.</p>
<form action="mailme.php" method="post">
Name: <input type="text" name="name"><br>
E-Mail: <input type="text" name="mail"><br>
<input type="submit" value="OK">
</form>
</html>