PHP Classes

code snippet for viewing eml file

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  code snippet for viewing eml file  >  (Un) Subscribe thread alerts  
Subject:code snippet for viewing eml file
Summary:eml viewer
Messages:9
Author:cwe
Date:2022-03-08 13:59:06
 

  1. code snippet for viewing eml file   Reply   Report abuse  
Picture of cwe cwe - 2022-03-08 13:59:06
Hi,

Do you have an example code snippet how to show the demo file /test/sample/message.eml
I use the file test_message_decoder.php and set 'SkipBody'=>0
The result please see screenshot:
dropbox.com/s/h83f0biapvqy7l3/eml.P ...

Best regards
Christoph


  2. Re: code snippet for viewing eml file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2022-03-09 12:19:21 - In reply to message 1 from cwe
Hello,

The test_message_decoder.php example script is meant to be run from the command line interface (shell on Linux or cmd on Windows).

Would you like an example that can show the message dump in a Web page instead of the command line interface?

  3. Re: code snippet for viewing eml file   Reply   Report abuse  
Picture of cwe cwe - 2022-03-09 14:22:49 - In reply to message 2 from Manuel Lemos
Hi,
thank you for your answer.
Yes, I want to create a eml viewer with pure php.
The eml file have to show within the internet browser.
Best regards
Christoph

  4. Re: code snippet for viewing eml file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2022-03-10 11:31:03 - In reply to message 3 from cwe
Sure. The test_message_decoder.php script, can be adapted to display the message contents in a Web page instead of dumping the message contents to the console line interface terminal.

Do you want more help on how to do that?

  5. Re: code snippet for viewing eml file   Reply   Report abuse  
Picture of cwe cwe - 2022-03-10 14:15:20 - In reply to message 4 from Manuel Lemos
Yes that would be nice.
I have only a normal webspace with php without console.
I use your test file /test/sample/message.eml
I want only see it in a normal browser like Chrome.
Best regards
Christoph

  6. Re: code snippet for viewing eml file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2022-03-10 18:19:00 - In reply to message 5 from cwe
Hello,

So basically, what you need to do is the following:

1. Change the script to present a form with a file upload input

2. The script will pass the uploaded file path to the class

3. The part that the class will parse the email message file is the same

4. After parsing the file, you need to change how you present the parsed message results. For text messages retrieved from parser results, you need to use the HtmlSpecialChars function to encode the text on the HTML page. For the message file structure, you may use HTML tables to show the parts of the message that it may contain.

Is this clear for you?

  7. Re: code snippet for viewing eml file   Reply   Report abuse  
Picture of cwe cwe - 2022-03-10 18:57:44 - In reply to message 6 from Manuel Lemos
Thank you for your patience. But I think it's too difficult for me to understand what I have to do. I'm not a very good programmer.
Perhaps I am looking for a ready code snippet.
Best regards
Christoph

  8. Re: code snippet for viewing eml file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2022-03-12 21:58:00 - In reply to message 7 from cwe
Hello,

I can try to implement that example when I have more time next weekend.

Would you wait for me to have more time to implement that example?

  9. Re: code snippet for viewing eml file   Reply   Report abuse  
Picture of cwe cwe - 2022-03-13 10:06:38 - In reply to message 8 from Manuel Lemos
I would be very happy about that. But there is no hurry. Thank you very much.
Best regards Christoph

 
For more information send a message to info at phpclasses dot org.