Jacobud, this is exactly what I'm looking for.
Could you send me the php source?
Sure it's a piece of cake:
There are four different php pages here:
contact.php <--- the page that people actually access and fill out the form and stuff
contactScript.php <---- the php script that no one can see (it contains your email address)
contactThankYou.php <--- the script/page that appears saying Thank You, afterword
contactError.php <---the script/page that appears saying error, you didn't fill the form out correctly
contact.php:
this is just a normal page in it. But when you get to your FORM tags, make it say this:
<form action="contactScript.php" method="post">
contactScript.php (this is the brain of the process):
<?php
$mailto = 'myemailaddress@somewhere.com' ;
$subject = "This is the subject of the email to be sent!!!" ;
$formurl = "
http://www.yoursite.com/contact.php" ;
$errorurl = "
http://www.yoursite.com/contactError.php" ;
$thankyouurl = "
http://www.yoursite.com/contactThankYou.php" ;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name))
$name = 'Anonymous';
if (empty($email))
$email = 'none';
if (empty($comments))
{
header( "Location: $errorurl" );
exit ;
}
$messageproper = "From: $name\nEmail: $email\n\n$comments";
mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.01" );
header( "Location: $thankyouurl" );
exit ;
?>
contactThankYou.php and contactError.php:
There is nothing special about either of these. They are just web pages that show up and say Thanks or Error.
There are a couple of nice things about this script.
1. All you have to do is fill out the top portion of the code. You don't really need to understand or pay attention to the algorithms themselves.
2. Your email address is hidden. The only place it's displayed is in the code of the contactScript.php.
3. Well what happens if someone knew that and typed in their browser:
www.mysite.com/contactScript.php? Well the browser simply opens up the contact.php. You can't look at contactScript.php at all through the browser.
Cool huh?

Hope this helps.