\r\n"); $res=fgets($cp,256); if(substr($res,0,3) != "250") return "MAIL FROM failed"; // Rcpt to... fputs($cp, "RCPT TO: <$to>\r\n"); $res=fgets($cp,256); if(substr($res,0,3) != "250") return "RCPT TO failed"; // Data... fputs($cp, "DATA\r\n"); $res=fgets($cp,256); if(substr($res,0,3) != "354") return "DATA failed"; // Send To:, From:, Subject:, other headers, blank line, message, and finish // with a period on its own line (for end of message) fputs($cp, "To: $to\r\nFrom: $from\r\nSubject: $subject\r\n\r\n\r\n$message\r\n.\r\n"); $res=fgets($cp,256); if(substr($res,0,3) != "250") return "Message Body Failed"; // ...And time to quit... fputs($cp,"QUIT\r\n"); $res=fgets($cp,256); if(substr($res,0,3) != "221") return "QUIT failed"; return true; } function clean($input) { // trim spaces from the beginning and the end of the variable $input = trim($input); // strip all HTML from the variables $input = stripslashes($input); $input = strip_tags($input); //$input = nl2br($input); return $input; } //echo mymail( $_POST['full_name'].'<'.$_POST['email'].'>','borgesr@csufresno.edu',$_POST['subject'],$_POST['message'],''); if(substr_count($_POST['email'],"@")>1 || substr_count($_POST['full_name'],"@")>1 || substr_count($_POST['subject'],"@")>1 || substr_count($_POST['message'],"@")>1) { header('location:../failure.html?error=security'); } else if($_POST['email']=='' || $_POST['full_name']=='' || $_POST['subject']=='' || $_POST['message']=='') { header('location:../failure.html?error=empty'); } else if($_POST['jokeoftheday']!='') { header('location:../failure.html?error=spammer'); } else { mymail( clean($_POST['email']),clean('ccoon@csufresno.edu'),clean('[website email]'. $_POST['subject']), clean($_POST['message']), ''); mymail( clean($_POST['email']),clean('sadiv@csufresno.edu'),clean('[website email]'. $_POST['subject']), clean($_POST['message']), ''); /*mymail( clean($_POST['email']),clean('jacoblee@csufresno.edu'),clean('CARBON COPY(emailvp) '.$_POST['subject'].' From: ' . $_POST['full_name']),clean($_POST['message']),'');*/ header('location:../success.html'); } //echo substr_count("@","@"); ?>