/* removing space characters from the edges of the data infos */
$_POST["mail_to"]=trim($_POST["mail_to"]);
$_POST["mail_name"]=trim($_POST["mail_name"]);
$_POST["mail_from"]=trim($_POST["mail_to"]);
$_POST["mail_subject"]=" אתר מצלמות התנועה המקיף בישראל";
$_POST["mail_body"]=" !שלום,\n\nחברך ".$_POST["mail_name"]." שלח/ה לך קישור לאתר מצלמות התנועה"."\n\n"."http://cam.vtop.co.il";
$mail_ok=true; //we assume the form is set correctly...
$worngMsg = "";
/* checking that the fields are filled ok */
if ($_POST["mail_to"]==""){
/* echo "
שם השולח הוא חובה
"; */
$mail_ok=false;
}
if ($_POST["mail_name"]==""){
/* echo "כתובת האימייל הוא חובה
"; */
$mail_ok=false;
}
if ($mail_ok) //if the fields are filled, we attempt to send the mail
{
$to=$_POST["mail_to"]; //the E-mail to send the message to
$subject=$_POST["mail_subject"]; //the subject of the mail
$body=$_POST["mail_body"]."\n\n\n"; //the body of the mail (a text added to every mail body)
$headers="From: ".$_POST["mail_from"]."\r\n"; //the headers of the mail
if ($_POST["mail_name"]!="") //if the name field is filled
$headers="From: ".$_POST["mail_name"]." <".$_POST["mail_from"].">\r\n"; //we add the name to the From header
/* attempt to send the message */
$mail_ok=@mail($to,$subject,$body,$headers); //returns true if mail was sent successfully, if not then returns false
if ($mail_ok) //if the mail was sent successfully
{
echo "הקישור נשלח בהצלחה!
";
echo "שלח שוב";
}
else
{
echo "שליחת ההודעה נכשלה !!!
בדוק את כתובת האי-מייל
";
}
}
else
{
echo "שם השולח והאימייל חובה
";
}
?>