>> Oh and cheers for the info someone gave me the other day, it inspired >> me to just connect to the pop3 server using a raw socket, SOOOOO much easier!!! >share the code please, I'm interested :) Ok... It's a bit rough and ready, never expected anyone else to want to look at this (at least not yet!) $host = 'mail.myserver.com'; $port = '110'; $user = 'me@xxxxxxxxxxxxx'; $pass = 'itsasecret'; $socket = fsockopen($host,$port); if (!$socket) { echo "Couldn't connect!"; } else { //is it connected? $res=getinfo($socket); echo "Testing connection... ".$res; echo "Send user..."; fputs($socket,"USER $user\n"); $res=getinfo($socket); echo $res; echo "Send pass..."; fputs($socket,"PASS $pass\n"); $res=getinfo($socket); echo $res; echo "Let's get the number of messages..."; fputs($socket,"STAT\n"); $res=getinfo($socket); $res = split(' ',$res); $res = $res[1]; echo trim($res)." messages\n"; if (trim($res) > 0) { echo "Let's get the array of messages...\n"; fputs($socket,"LIST\n"); $res=getinfo($socket);//gets rid of the OK $res=getinfo($socket); $res = split("\n",$res); //print_r($res); foreach ($res as $key => $value) { if ((trim($value) != '.') and (trim($value != ""))) { $value = split(" ",$value); $mids[] = $value[0]; } } //print_r($mids); echo "Now we have a list of message IDs, we'll extract each message\nand save under it's MID\n"; foreach ($mids as $key => $value) { echo "Requesting $value\n"; fputs($socket,"RETR $value\n"); $res=getinfo($socket);//gets rid of the OK $res=getinfo($socket); $res = split("\n",$res); $cont = true; foreach ($res as $key2 => $value2) { if ((trim($value) != '.') and ($cont == true)) { $msg[] = $value2; } else { $cont = false; } } $res = join("\n",$res); echo "Saving $value\n"; file_put_contents('my/save/folder/'.$value.'.txt',$res); } } echo "Finally, let's quit..."; fputs($socket,"QUIT\n"); $res=getinfo($socket); echo $res; } function getinfo($socket) { $buff = ''; $continue = true; while (!feof($socket) and ($continue==true)) { $buffer = fgets($socket); if (substr($buffer,0,4) == '-ERR') { $res = 'error'; $continue = false; } if (substr($buffer,0,3) == '+OK') { $res = 'ok'; $continue = false; } if (trim($buffer) == '.') { $res = 'end'; $continue = false; } $buff .= $buffer; } return $buff; } This was designed to run as a CLI app, may need tweaking to run through http. Not fully tested, but does what I want! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php