"; $maximo_de_respostas = 5; set_time_limit(299); $port=110; $server="pop3.yandex.ru"; //conta pop $address="xxxx@yandex.ru"; //e-mail $username=russiaonline; //nome de usuário $password=base64_encode(senha); //coloque aqui a senha // va até a linha 142 para terminar a configuração if ($password != "") $password = base64_decode($password); // open socket to server and check connection status $mailserver=fsockopen($server,$port,&$errno,&$errstr,30); if(!$mailserver){ print("
Falha na conexão!
"); exit; // Connection ok } else { // Welcome Message $buffer=fgets($mailserver,512); // USER $buffer="USER $username\n"; fputs($mailserver,$buffer); $buffer=fgets($mailserver,512); // PASS $buffer="PASS $password\n"; fputs($mailserver,$buffer); // Authentification OK/ERR $buffer=fgets($mailserver,512); if (substr($buffer,0,4)=="-ERR") { printf("
Usuário ou senha inválido!
"); fclose($mailserver); exit; } // Authentification OK else { if ($address != '') print("
Caixa de Entrada: $address
"); else print(" Caixa de Entrada $username@$server
"); // STATUS $buffer="STAT\n"; fputs($mailserver,$buffer); $buffer=fgets($mailserver,512); $answ=explode(" ", $buffer); $mailsum=$answ[1]; $mailmem=$answ[2]; // LIST and get msg's size $ahem = (int) $mailsum; for ($q = 1; $q <= $ahem; $q++){ $buffer="LIST ".$q."\n"; fputs($mailserver,$buffer); $buffer=fgets($mailserver,512); $tablo=explode(" ", $buffer); $saize[]=$tablo[2]; } if (!isset($lastdone)) $lastdone=$mailsum; $mailtop = $mailsum; $mailbot = 1; $lastdone = $mailtop; echo "\nListando e-mails: ".$mailbot." a ".$mailsum.", começando de ".$mailtop."
\n"; // table header print(""); print (""); // Load mails for($msgid=$mailtop;$msgid>=$mailbot;$msgid--) { // TOP mail 0 $buffer="TOP $msgid 0\n"; fputs($mailserver,$buffer); $buffer=fgets($mailserver,512); for(;;) { $buffer=fgets($mailserver,512); if(strcasecmp(substr($buffer,0,5),"Date:")==0) { $maildate=substr($buffer,6,strlen($buffer)-6); } if(strcasecmp(substr($buffer,0,5),"From:")==0) { $fromperson=substr($buffer,6,strlen($buffer)-6); $fromperson=htmlspecialchars($fromperson); } if(strcasecmp(substr($buffer,0,3),"To:")==0) { $toperson=substr($buffer,4,strlen($buffer)-4); $toperson=htmlspecialchars($toperson); } if(strcasecmp(substr($buffer,0,8),"Subject:")==0) { $subject=substr($buffer,9,strlen($buffer)-9); $subject=htmlspecialchars($subject); } if(strcmp($buffer,"\r\n")==0 || strcmp($buffer,"\n\r")==0 || strcmp($buffer,"\n\n")==0 && $maildate!=0 && $subject!=0 && $fromperson!=0) { break; } } $msgsize = $saize[$msgid-1]; $datearray = explode(" ", $maildate); if (sizeof($datearray) == 6){ $maildate = $datearray[0]." ".$datearray[1]." ".$datearray[2]." ".$datearray[3]."
".$datearray[4]." ".$datearray[5]; } if (sizeof($datearray) == 5){ $maildate = $datearray[0]." ".$datearray[1]." ".$datearray[2]."
".$datearray[3]." ".$datearray[4]; } $buffer = explode("<", $fromperson); if (sizeof($buffer) == 2){ $fromperson = implode("
<", $buffer); } # Remove ISO encoding. We must do it more nicely...in the future! $fromperson = str_replace("=?iso-8859-1?Q?", "", $fromperson); $fromperson = str_replace("=?ISO-8859-1?Q?", "", $fromperson); $subject = str_replace("=?iso-8859-1?Q?", "", $subject); $subject = str_replace("=?ISO-8859-1?Q?", "", $subject); $msgsizekb= ceil($msgsize/1000); // Para mostrar em Kb o tamanho da msg +++ // if (strlen($subject) > 32) $subject = substr($subject, 0, 32)."..."; //################################################################################################### //################################################################################################### // Coloque aqui os comandos a serem realizados $subject = trim($subject); //apagar e-mail com assunto especificado substr($subject, 0, 32) if (substr($subject, 0, 14) == "[OBORONA-SPAM]") { $situacao = "
Apagado
"; // Apaga a mensagem $buffer="DELE $msgid\n"; fputs($mailserver,$buffer); $buffer=fgets($mailserver,512); // echo "id da msg $msgid"; } else {$situacao = "
Mantido
";}; //################################################################################################### //################################################################################################### // fim do comando apagar print(" "); print(""); $subject=0; $maildate=0; $fromperson=0; while (substr($buffer, 0, 1) != '.') { $buffer=fgets($mailserver,512); } } print("
DataTamanhoDeAssuntoStatus
$maildate
$msgsizekb Kb
$fromperson $subject $situacao
\n\n\n"); // QUIT $buffer="QUIT\n"; fputs($mailserver, $buffer); $buffer=fgets($mailserver,512); // close connection fclose($mailserver); } } ?>