"recommend this site" code?

Miscellaneous Forums/General Discussion/"recommend this site" code?

I would ask for the names and e-mail, then send a msg to the person that clearly states what you want it to, and is really polite, as for the code to mail to them


Form html

<form action="mailer_sender.php" method="post">
Your Name<br>
<input type="text" name="sender_name"><br>
<br>
Your Friend's Name<br>
<input type="text" name="friend_name"><br>
<br>
E-mail addy of your friend<br>
<input type="text" name = "email"><br>
<br>
<input type="submit" value="submit">
</form>



mailer_sender.php (just the php)

<?
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}
$sender_name=$_POST['sender_name'];
checkOK($sender_name);
$friend_name=$_POST['friend_name'];
checkOK($friend_name);
$email=$_POST['email'];
checkOK($email);
$to=$email;
$message="Polite MSG that talks about your site and whatever else.";
if(mail($to,"$sender_name, thought you might like to know about this",$message,"From: you@...")) {
echo "We are telling them about it.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>



This SHOULD work, but might not if you don't have the right permissions when it comes to mail from your mail provider... Earthlink addresses through Comcast connections seem not to work at all, but you should have no problems if you host the files with the same host that sends you your mail. As in, you host the mailer at www.yoursite.com and send to you@....