Nstiac - 2008-12-12 08:28:23
Hello,
First of all KUDOS for both classes pop3 & mime parser!!!
Here's the thing, i've managed to get a working test up & running prefectly, but once i browsed and parsed all messages in my gmail inbox i'm unable to list them or see them anymore ?!!
My point, once i've seen the message, even if there is no delete message code on my script, messages get lost! i can't fetch them anymore!
"There are 0 messages in the mail box with a total of 0 bytes."
So i guess the question would be, how to stop the parser from deleting messages once parsed ?... (yeah.. now i see that this should be placed on the mime parser discussion).... YET... since i'm using the pop3 class with the pop3 stream function to retrieve the messages as files for the parser. well... i'll leave it to you to decide where this post should go.
'cause i'm guessing that when using the stream-file function it fetches the emails as RETR so how to let it know that it's only a read not read & delete.
Thanks & kudos again!
Nstiac
P.S.- I attach the script used...
---------
<?php
require('mime_parser.php');
require('rfc822_addresses.php');
require("pop3.php");
require("sasl.php");
stream_wrapper_register('pop3', 'pop3_stream');
$pop3=new pop3_class;
$pop3->hostname="pop.googlemail.com";
$pop3->port=995;
$pop3->tls=1;
$user="xxxx@googlemail.com";
$password="xxxxx";
$pop3->realm="";
$pop3->workstation="";
$apop=0;
$pop3->authentication_mechanism="USER";
$pop3->debug=0;
$pop3->html_debug=1;
$pop3->join_continuation_header_lines=1;
if(($error=$pop3->Open())=="")
{
echo "";
if(($error=$pop3->Login($user,$password,$apop))=="")
{
echo "";
if(($error=$pop3->Statistics($messages,$size))=="")
{
echo "";
if($messages>0)
{
$pop3->GetConnectionName($connection_name);
$message=$messages;
$message_file='pop3://'.$connection_name.'/'.$message;
$mime=new mime_parser_class;
$mime->decode_bodies = 1;
$parameters=array('File'=>$message_file);
$success=$mime->Decode($parameters, $decoded);
if(!$success)
echo '<h2>MIME message decoding error</h2>\n";
else
{
if($mime->Analyze($decoded[0], $results))
{
//echo '<h2>Message analysis</h2>'."\n";
echo '<pre>';
//var_dump($results);
echo $results['Date']."<br>";
echo "<h2>".utf8_encode($results['Subject'])."</h2><br><br>";
echo utf8_encode($results['Data']);
echo '</pre>';
}
else
echo 'MIME message analyse error: '.$mime->error."\n";
}
}
if($error==""
&& ($error=$pop3->Close())=="")
echo "<PRE>Disconnected from the POP3 server.</PRE>\n";
}
}
}
if($error!="")
echo "<H2>Error: ",HtmlSpecialChars($error),"</H2>";
?>