\r\n"); $res=fgets($cp,256); if(substr($res,0,3) != "250") return "MAIL FROM failed"; // Rcpt to... fputs($cp, "RCPT 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['subject'],"@")>1 || substr_count($_POST['message'],"@")>1) { header('location:../failure.php?error=security'); } else if($_POST['subject']=='' || $_POST['message']=='') { header('location:../failure.php?error=empty'); } else { mymail( clean('donotreply@csufresno.edu'),clean('poliaro@csufresno.edu'),clean('[Budget Suggestion Box]'.$_POST['subject']),clean($_POST['message']),''); header('location:../success.php'); } //echo substr_count("@","@"); ?>