if(isset($submit)) { if(!eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+[a-zA-Z0-9\-\.]+$",$sender)) { $errormsg ="Sorry! your e-mail is incorrect."; } else if(!eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+[a-zA-Z0-9\-\.]+$",$recipient)) { $errormsg ="Sorry! your friend's e-mail is incorrect."; } else { $msg2 ="This email was sent to you by a friend.\n\n".$sender." thinks you would be interested in visiting the website of Foundation for Slum Child Care at \n"; $msg2.="http://www.fscc.or.th/ \n\nHere is their message : \n".$msg; $flag= mail($recipient , "Please look at this website" , $msg2 , "From: $sender"); if($flag) $errormsg="Thank you! your e-mail has been sent already."; else $errormsg="Sorry! sending mail failed. Please try again."; } } ?>