= "4.2.0"){ extract($_POST); extract($_SERVER); extract($_ENV); } #Format output for console or for web? $nl = ((isset($REMOTE_ADDR)) ? "
" : "\n"); if(!$sock=fsockopen($host, 110, $err, $errno, 10)) die("Couldn't connect to the POP server$nl"); fputs($sock, "USER $user\r\n"); $buf = fgets($sock, 1024); if($buf[0] != '+') die("POP server didn't like USER $user$nl"); fputs($sock, "PASS $pass\r\n"); $buf = fgets($sock, 1024); if($buf[0] != '+') die("POP server didn't like PASS$nl"); fputs($sock, "STAT\r\n"); $buf = fgets($sock, 1024); fputs($sock, "STAT\r\n"); $buf2 = fgets($sock, 1024); list($stat, $num, $size) = split(' ', $buf2, 3); echo "There are $num messages$nl"; for($i=1; $i<=$num; $i++){ $command = "DELE $i\r\n"; echo "Deleting message $i with DELE $i$nl"; fputs($sock, $command); $buf = fgets($sock, 1024); if($buf[0] != '+') die("POP server didn't like DELE $i: ($buf)$nl"); } fputs($sock, "QUIT\r\n"); $buf = fgets($sock, 1024); fclose($sock); ?>