Hard to tell with what you posted, would have to see the form and rest of the page(s).
I cleaned this up a bit:
Code:
if(isset($send)) {
header("Location: http://www.domain.com/thanks.htm");
} else {
echo "We encountered an error sending your mail";
}
// Everything below this is useless unless there is more code not shown.
exit();
}