2 $serv = "pop3.seznam.cz";
4 $mail = "harvie@seznam.cz";
5 $pass = "harddaysnight";
8 ///FUNCS///////////////////////////////////////////////////////////////
10 function pop3_connect($mail, $pass, $serv, $port=110) {
11 $fserv = fsockopen($serv, $port);
12 if(!$fserv) return -1; //Cannot connect
13 $resp = fgets($fserv); //echo($resp); //Debug
14 $request = "USER $mail\nPASS $pass\n";
16 fwrite($fserv, $request);
17 $resp = fgets($fserv); if (!eregi("\\+", $resp)) return -2; //Bad username
19 $resp = fgets($fserv); if (!eregi("\\+", $resp)) return -3; //Bad password
25 function pop3_cmd($fserv, $cmd) {
27 fwrite($fserv, $request);
28 return trim(fgets($fserv));
31 function pop3_check($fserv) {
34 case -1: echo("Cannot conect!\n"); break;
35 case -2: echo("Bad username!\n"); break;
36 case -3: echo("Bad password!\n"); break;
40 function pop3_unread($fserv) {
41 $resp = pop3_cmd($fserv, "STAT");
42 $resp = explode(" ", $resp);
43 return trim($resp[1]);
46 function pop3_quit($fserv) {
47 pop3_cmd($fserv, "QUIT");
50 ///CODE/////////////////////////////////////////////
54 //echo pop3_cmd($fserv, "STAT")."\n";
58 if(!isset($fserv) ||
!$fserv) {
59 $fserv = pop3_connect($mail, $pass, $serv, $port);
62 $unread = pop3_unread($fserv);
63 if($unread != $last_unread && $unread != "") {
64 echo("You have $unread messages!\n");
65 $last_unread = $unread;
78 +OK Hello, this is Seznam POP3 server 2.3.16.
81 +OK Enter your password please.
This page took 0.947636 seconds and 4 git commands to generate.