latheesan
12-12-2005, 05:06 PM
hello,
I coded this like in 10 minutes, (i know, took me longer than it should). For some absurd reason, it isnt working
please have a look at this code:
<?php
$friend_email = $_POST['friend_email'];
$subject = "checkout this site";
$your_name = $_POST['your_name'];
$your_email = $_POST['your_email'];
$message_str = $_POST['message'];
$message = "$your_name has recommended you to our site. He also said:<br><br>$message_str";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$_POST['friend_email'].' <'.$friend_email.'>' . "\r\n";
$headers .= 'From: Recommendation from <'.$your_email.'>' . "\r\n";
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $friend_email)){
header("Location: /error.php?id=8");
}elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $your_email)){
header("Location: /error.php?id=9");
exit();
}else
if (($_POST['your_name']) && ($_POST['your_email']) && ($_POST['friend_email']) && ($_POST['message'])){
mail($friend_email, $subject, $message, $headers);
header("Location: /thankyou.php");
}else{
header("Location: /error.php?id=10");
}
?>
seems right to me, what do you think? it wont email anyone when i try to post values to this file called mail.php from "recommend_me.php" file
I coded this like in 10 minutes, (i know, took me longer than it should). For some absurd reason, it isnt working
please have a look at this code:
<?php
$friend_email = $_POST['friend_email'];
$subject = "checkout this site";
$your_name = $_POST['your_name'];
$your_email = $_POST['your_email'];
$message_str = $_POST['message'];
$message = "$your_name has recommended you to our site. He also said:<br><br>$message_str";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$_POST['friend_email'].' <'.$friend_email.'>' . "\r\n";
$headers .= 'From: Recommendation from <'.$your_email.'>' . "\r\n";
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $friend_email)){
header("Location: /error.php?id=8");
}elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $your_email)){
header("Location: /error.php?id=9");
exit();
}else
if (($_POST['your_name']) && ($_POST['your_email']) && ($_POST['friend_email']) && ($_POST['message'])){
mail($friend_email, $subject, $message, $headers);
header("Location: /thankyou.php");
}else{
header("Location: /error.php?id=10");
}
?>
seems right to me, what do you think? it wont email anyone when i try to post values to this file called mail.php from "recommend_me.php" file
