PHP Classes

OpenMessage

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  OpenMessage  >  (Un) Subscribe thread alerts  
Subject:OpenMessage
Summary:Does OpenMessage return the message
Messages:16
Author:william drescher
Date:2007-06-01 11:46:55
Update:2007-06-09 04:12:45
 
  1 - 10   11 - 16  

  1. OpenMessage   Reply   Report abuse  
Picture of william drescher william drescher - 2007-06-01 11:46:55
The doc says: <pre>/* OpenMessage method - the $message argument indicates the number of
a message to be opened. The $lines argument tells how many lines of
the message are to be retrieved. Pass a negative number if you want
to retrieve the whole message. */</pre>

but it appears that OpenMessage does not actually return anything but an error, if there is one. Is that correct ?
If not, how is the message returned ?

  2. Re: OpenMessage   Reply   Report abuse  
Picture of william drescher william drescher - 2007-06-01 12:47:44 - In reply to message 1 from william drescher
Further: What I want to do is retrieve a message using pop3_class and then pass it to mime_parser_class for decoding. get_message appears to not be the correct way of getting the message as it splits the headers from the body and it seems that mime_parser wants the raw message.

Perhaps you would be so kind as to post a very simple script that shows the integration of pop_message_class and mime_parser_class to get one message and decode it ?

Thanks for writing the classes and for the continuing support.

bill

  3. Re: OpenMessage   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-06-01 18:28:16 - In reply to message 1 from william drescher
OpenMessage does not retrieve the messages. It just tells the class to start reading the data of a message. You need to use GetMessage to retrieve the message data itself in chunks.

  4. Re: OpenMessage   Reply   Report abuse  
Picture of william drescher william drescher - 2007-06-01 18:34:42 - In reply to message 3 from Manuel Lemos
What is the need for the $lines parameter in OpenMessage as it does not download message lines ?

  5. Re: OpenMessage   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-06-01 18:37:15 - In reply to message 2 from william drescher
You need to use OpenMessage followed by GetMessage to retrieve the whole message data.

You can also use the POP3 class stream handler to tell PHP to treat messages in the mailbox as if it were regular disk files. Take a look at the parse_message.php for an example.

  6. Re: OpenMessage   Reply   Report abuse  
Picture of william drescher william drescher - 2007-06-01 19:11:15 - In reply to message 5 from Manuel Lemos
I got it !
The $lines parameter in OpenMessage says how large the chunks will be when one calls GetMessage.

Question: IN using the streams handler in POP3_class:
$message_file='pop3://'.$user.':'.$password.'@localhost/'.$message. '?debug='.$debug.'&html_debug='.$html_debug.'&realm='.$realm.'&workstation='.$workstation. '&apop='.$apop.'&authentication_mechanism='.$authentication_mechanism;

if the ISPs mail server is 'pop.mailserver.com', and
my account is 'myaccount@mydomain.com', and
my password is 'password',

what would the form of the request be ?

$message_file='pop3://'.$user.':'.$password.'@mydomain.com:110/'.$message.
'?debug='.$debug.'&html_debug='.$html_debug.'&realm='.$realm.'&workstation='.$workstation. '&apop='.$apop.'&authentication_mechanism='.$authentication_mechanism;

  7. Re:GetMessage   Reply   Report abuse  
Picture of william drescher william drescher - 2007-06-01 19:35:31 - In reply to message 5 from Manuel Lemos
I am still confused:
OpenMessage has a $lines parameter, which can be set to -1 to indicate all lines.
Get Message has a $count parameter that must be set to a number of characters.
I presume from testing that this is a max number and need not be an exact number. Correct ?

I still don't see the utility of the $lines parameter.

  8. Re: OpenMessage   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-06-01 21:28:20 - In reply to message 6 from william drescher
$user = UrlEncode('myaccount@mydomain.com');
$password = UrlEncode('password');
$message = 1;
$debug = 1;
$html_debug = 1;

$message_file='pop3://'.$user.':'.$password.'@mydomain.com/'.$message. '?debug='.$debug.'&html_debug='.$html_debug;

  9. Re: OpenMessage   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-06-01 21:33:07 - In reply to message 7 from william drescher
The $lines parameter should be set to -1 unless you only want to receive the first few lines that you specify.

The $count parameter defines the limit size of the chunks of the message that you will retrieve on each call to the GetMessage function. Set it to no more than a few tens of K so you do not exceed the memory limits set in PHP configuration when you are retrieving large messages.

  10. Re: OpenMessage   Reply   Report abuse  
Picture of william drescher william drescher - 2007-06-02 18:05:13 - In reply to message 9 from Manuel Lemos
THank you for all the help.
Got it working now.

 
  1 - 10   11 - 16