$v){ $econtent = ''; if($k == 0){ continue; }else{ $email = explode(" ",$v); $usenet1 = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); $login = fgets($usenet1, 1280); fputs ($usenet1, "auth login\r\n"); $login = fgets($usenet1, 1280); fputs ($usenet, "XXXXXXXX\r\n"); //User name in base 64 encoding $login = fgets($usenet1, 1280); fputs ($usenet, "XXXXXXXX\r\n"); //password in base 64 encoding $login = fgets($usenet1, 1280); fputs ($usenet1, "STAT\r\n"); //STAT command will retrieve the list of email inside the server. $login = fgets($usenet1, 1280); fputs ($usenet1, "RETR ".$email[0]."\r\n"); $econtent .= fread($usenet1, $email[1]*10); if(strpos($econtent, "failure notice") > 0 || strpos($econtent, "Out of Office") > 0 || strpos($econtent, "Returned mail") > 0 || strpos($econtent, "Returned Mail") > 0 || strpos($econtent, "Delivery Status") > 0 || strpos($econtent, "Undelivered Mail") > 0 || strpos($econtent, "Auto-Reply") > 0 || strpos($econtent, "Undeliverable") > 0 || strpos($econtent, "Failure") > 0 || strpos($econtent, "failed") > 0 || strpos($econtent, "out of") > 0 || strpos($econtent, "CHANGE OF EMAIL ADDRESS NOTIFICATION") > 0 || strpos($econtent, "SPAM") > 0 || strpos($econtent, "is away") > 0 || strpos($econtent, "DELIVERY FAILURE") > 0){ //Executing delete email fputs ($usenet1, "DELE ".$email[0]."\r\n"); } //MUST executing QUIT so that the mail server will dele the email. fputs ($usenet1, "QUIT\r\n"); fclose($usenet1); } $count++; } } } fclose($usenet); ?>