Manuel Lemos - 2011-11-10 07:44:13 - In reply to message 1 from liu chun fong
1. RetrieveMessage get you the whole message (or just a few lines) all at once. OpenMessage and GetMessage lets you read the message in small chunks at a time, so it does not exceed your PHP memory limits when you get a very large message.
2. test_pop3.php is an example of all features of the class including deleting message. browse_mailbox.php shows you how to open a POP3 mailbox and process all its messages using the MIME parser class. parse_message.php shows you how to parse a single message with the MIME parser class using the POP3 stream wrapper that lets you retrieve messages as if they were files.
3. Any of the above examples show you how to do that but be careful because if you get large messages you may halt your script processing whole message bodies at once in memory depending on the method that you pick.
4. Yes, MIME parser lets you parse any type of e-mail message and can store message body parts into files if you want.
Manuel Lemos - 2011-11-15 09:20:44 - In reply to message 4 from liu chun fong
In case you have not noticed, the MIME parser class comes with documentation that explains all those parameters.
Anyway, if you use the SaveBody parameters, the class saves the data of body parts to files, so those body parts data is not returned in variables, as it may be too large to fit within the PHP memory limits.
liu chun fong - 2011-11-16 10:48:35 - In reply to message 5 from Manuel Lemos
Thank you very much!!
Although the variable have comments, I still can't understand the meaning of 'Data', 'SkipBody'. But now I can use 'SaveBody' to store file in my localhost.
Q1:Are 'SaveBody' and 'SkipBody' exclusive??
Because you say that 'SaveBody' will 'Save the message body parts to a directory', and 'SkipBody' is 'Do not retrieve or save message body parts', It makes me confused.
Q2:What the 'Data' variable meaning?
It say if I have files just like aaa.txt, I can write 'Data' = D:\pic\aaa.txt(the routing just a example)??
Q3:I can fetch attachment file(e.g:the picture named 1234.jpg),
I use $results['Attachment']['Data'] to achieve my goal, but when I echo $results['Attachment']['Data'], it will output garbage characters. so, it can't output normal characters.
Your example 'browse_mailbox.php' can output
I use $results['Attachment']['Data'] may be output
Manuel Lemos - 2011-11-16 19:26:19 - In reply to message 6 from liu chun fong
SkipBody is just for telling the class to not parse the message body contents.
SaveBody is about what to do with the results of parsing. In that case the result is to save the body parts to files.
Data is to use when you have the whole message contents in a string. It is not a file name, it is the message contents.
The contents of a JPEG image are binary. If you try to output the contents of that image as text, it shows garbage, not the image. To show the image as image in a browser you cannot dump its contents as text. You need to send the header Content-type: image/jpeg and then you output image data contents.
The debug output shows what comes and goes to the server. Usually it is encoded using base64, so all characters are readable.