A simple example. If your form field names are fname, lname, email, msg and your method is POST.
<?php
if (isset($_POST['submit'])) {
$to = "me@foo.com";
$subject = "email recieved from site";
$msg = "{$_POST['fname']} {$_POST['lname']} from {$_POST['email']} sent you the following message\n\n{$_POST['msg']}";
if (mail($to, $subject, $msg)) {
header("Location : thankyou.html");
}
}
?>