PHP Classes

mime decode and message file problem

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  mime decode and message file problem  >  (Un) Subscribe thread alerts  
Subject:mime decode and message file problem
Summary:mime decode and message file problem
Messages:3
Author:Mushfiqur Rahman
Date:2011-05-29 09:53:12
Update:2011-05-30 09:40:07
 

  1. mime decode and message file problem   Reply   Report abuse  
Picture of Mushfiqur Rahman Mushfiqur Rahman - 2011-05-29 09:53:12
Hi,
I am using your pop3 and it's working great. Before telling about my problem I think I need to say something about my objective of using it.

I want to pop mails from various account and also want to parse them so that I can store them properly in my database.

That's why I am using a loop. First of all I make a list of messages which is pop-able and do this in a loop. After creating that list I start to parse them one by one in another loop. All the works I am doing in a single Open and Close connection.

Now I am telling about my problem. When I want to decode a message from gmail I need to create a parameter called $parameters which will be passed to $mime->decode() method. Would you please explain how should I make a $message_file variable for the $parameters argument for gmail and other email account?

I am giving an example:
If I made it in the following way then it failed to parse all messages (one by one)from gmail.
[code]

for($no_of_message_to_decode=1;$no_of_message<=$total_popable_message;$no_of_message_to_decode++)
{
.......
$message_file='pop3://'.UrlEncode($user).':'.UrlEncode($password).'@'.$hostname.':'.$port.'/'.$no_of_message_to_decode.'?tls='.$tls.'&debug='.$debug.'&html_debug='.$html_debug;
.......
}

[/code]

but if I create it in the following way then it can decode all messages from gmail but failed to decode from other account:
[code]

for($no_of_message_to_decode=1;$no_of_message<=$total_popable_message;$no_of_message_to_decode++)
{
.......
$message_file='pop3://'.UrlEncode($user).':'.UrlEncode($password).'@'.$hostname.':'.$port.'/1'.'?tls='.$tls.'&debug='.$debug.'&html_debug='.$html_debug;
.......
}

[/code]

Would you please how can I create this variable in a general form?
Waiting for your response.
Thanks.
Mushfique

  2. Re: mime decode and message file problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-05-30 00:39:37 - In reply to message 1 from Mushfiqur Rahman
The problem is that the way you are doing you are telling the POP 3 stream wrapper class to open and close the POP 3 mailbox on each message you retrieve.

If you are retrieving all messages within a single Open and Close access, you need to use a different connection specification in the message file URL.

You need to use the GetConnectionName function to get a connection name instead of user and host name string. Take a look at the browse_mailbox.php script for an example.

  3. Re: mime decode and message file problem   Reply   Report abuse  
Picture of Mushfiqur Rahman Mushfiqur Rahman - 2011-05-30 09:40:08 - In reply to message 1 from Mushfiqur Rahman
Hi Manuel Lemos,

Thanks for your cordial reply.
I have followed your suggestion and now it's working exactly what I want. Actually this was the thing for which I was looking.

Again many thanks.