Firstly thanks a lot for your class(es), they are really great. Also thanks more for your incredible support, I couldn't find even 1 question which wasn't unanswered, you are great!
I'm trying to integrate your pop3 class with mimeparser class. Your mimeparser class parses "EML" formatted files great. It is also capable of parsing strings when "Data" parameter is populated.
I don't want to use "file structure" for keeping messages though. So my goal is to use mysql and keep messages there as EML strings. After they are inserted into database like this, I'll query them in my script, pust them to mimeparser via data parameter.
However I'm not sure how to create this format with pop3 class? How can I pull a single message from POP3 server with pop3 class and instead of saving it into a EML file, convert it into a string to save into database?
command retrieves the email fine and we have these 2 arrays for header and body. But is it possible to turn this returned email into a EML string?
I don't want to use format:
because this format accesses the message online. I want to pull it from server with $pop3->RetrieveMessage first, then convert it to the exact format $message_file='pop3://'.$connection_name.'/'.$message; command has.
Thanks in advance for your support!
|2012-12-02 20:31:00 - In reply to message 1 from Kerem Ušar|
|The RetrieveMessage function already parses the message to split the headers.|
So you need to use the PHP fopen function with the pop3:// URL and retrieve the whole message to string with the PHP fread and feof functions. Then you save the message to the database.
From then on you no longer need the POP3 class. Just use the MIME parser class to parse the message again if you need that.
Anyway, I do not recommend that you store arbitrary large messages in the MySQL database. That may cause that your script exceeds the PHP memory limits and your scripts are aborted.