PHP Classes

Problem with decode

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  Problem with decode  >  (Un) Subscribe thread alerts  
Subject:Problem with decode
Summary:Problem with decode
Messages:6
Author:Luca Mainieri
Date:2008-10-07 17:09:29
Update:2008-10-10 07:04:35
 

  1. Problem with decode   Reply   Report abuse  
Picture of Luca Mainieri Luca Mainieri - 2008-10-07 17:09:30
Hi Manuel,
thank you for your work.

Although I can connect, I have problems on running the
parse_message.php.
The code goes in time out at line 64
$success=$mime->Decode($parameters, $decoded)

I have done all tests with test_pop3.php and it seams working correctly. I can connect to the mailbox and retrieve the messages. I'm using the same parameters for both scripts...

with myusername/mypassword/mymailserverdomain

like follows...

++++++++++++++++++++++++++++++++++++++++++++++++++


$user=UrlEncode("myusername");
$password=UrlEncode("mypassword");
$realm=UrlEncode(""); /* Authentication realm or domain */
$workstation=UrlEncode(""); /* Workstation for NTLM authentication */
$apop=0; /* Use APOP authentication */
$authentication_mechanism=UrlEncode("USER"); /* SASL authentication mechanism */
$debug=1; /* Output debug information */
$html_debug=1; /* Debug information is in HTML */
$message=1;
$message_file='pop3://'.$user.':'.$password.'@mymailserverdomain/'.$message.
'?debug='.$debug.'&html_debug='.$html_debug.'&realm='.$realm.'&workstation='.$workstation.
'&apop='.$apop.'&authentication_mechanism='.$authentication_mechanism;

+++++++++++++++++++++++++++++++++++++++++

No debug infos...
The scripts stops for time_out
I have increased the max_execution_time to 120, but its still not enough.

Do you have any suggestion in order to make it work?
I'm running my test on a wamp system with PHP5.2 and APACHE 2.2
My current task is to read the content from a mailbox, register the email sender and body in a db table, cancel the content of the mailbox. I can accomplish these tasks using your class?

Thank you again for your support!

Luca

  2. Re: Problem with decode   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-10-07 18:09:03 - In reply to message 1 from Luca Mainieri
In general the class is reasonably fast, but if you want to process very large messages it may take a while.

What is the size of the messages that you want to process?

  3. Re: Problem with decode   Reply   Report abuse  
Picture of Luca Mainieri Luca Mainieri - 2008-10-08 07:36:26 - In reply to message 2 from Manuel Lemos
Hi Manuel, thank you for your prompt reply!
Actually the messages are very small, and never with attachments (they come from an online form)...

Anyhow, I have moved the scripts to a remote server and now it seem working fine (even if the server has the same php/apache configuration then my local...). It could have been a misconfiguration in my local server.

Thank you again....

Luca

  4. Re: Problem with decode   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-10-08 23:04:25 - In reply to message 3 from Luca Mainieri
Maybe you had your message files stored in networked file system that slowed down message data access.

  5. Re: Problem with decode   Reply   Report abuse  
Picture of Luca Mainieri Luca Mainieri - 2008-10-09 14:36:50 - In reply to message 4 from Manuel Lemos
Hi Manuel,

I'm still have some doubts about the pop3 class, maybe you can help me...
I have got some trouble to delete the mails using the
DeleteMessage($message)
method. The $message parameter seems not passed correctly to the delete method...

This lines are generating the following error...

.....
$result=$pop3->ListMessages("",0);
if(GetType($result)=="array"){

for(Reset($result), $message=0; $message<count($result); Next($result), $message++){

if($debug_messages) echo "<PRE>I'm starting parsing the '".$message."' message</PRE><hr>\n";
//here is outputted ...'I'm starting parsing the '0' message'
$error=$pop3->DeleteMessage($message); if($error != '') { die($error); } else { if($debug_messages) echo "<PRE>Message $message marked for delete.</PRE><hr>\n";}

etc....

------
C LIST
S +OK POP3 clients that break here, they violate STD53.
S 1 1505
S 2 1586
S .

I'm starting parsing the '0' message

C DELE 0
S -ERR Invalid message number.
Could not delete the message: Invalid message number.
-----

Thank

Luca

  6. Re: Problem with decode   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-10-10 07:04:35 - In reply to message 5 from Luca Mainieri
The ListMessages function returns an associative array which returns the message identifier as key. That is what you should use to pass as parameter to the DeleteMessage function. In your example you have messages with identifier 1 and 2, not 0 .