function pop3_open($server, $port) { global $POP3_GLOBAL_STATUS; $pop3 = fsockopen($server, $port); if ($pop3 <= 0) return 0; $line = fgets($pop3, 1024); $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1); $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024); if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0; return $pop3; } function pop3_retr($pop3, $nr) { global $POP3_GLOBAL_STATUS; fputs($pop3, "RETR $nr\r\n"); $line = fgets($pop3, 1024); $POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1); $POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024); if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0; while (substr($line = fgets($pop3, 1024), 0, 1) <> ".") { $data[$i] = $line; $i++; } $data["count"] = $i; return $data; }