PHP Classes

EML/MHT/MHTML to HTML in PHP?

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  EML/MHT/MHTML to HTML in PHP?  >  (Un) Subscribe thread alerts  
Subject:EML/MHT/MHTML to HTML in PHP?
Summary:Is there a way in PHP to convert from EML/MHTML/MHT file to HTML
Messages:2
Author:Alex Tween
Date:2008-06-09 05:16:57
Update:2008-06-09 05:28:06
 

  1. EML/MHT/MHTML to HTML in PHP?   Reply   Report abuse  
Picture of Alex Tween Alex Tween - 2008-06-09 05:16:57
First off, i want to thank Manuel for the great and useful package he created here and for being so responsive on the discussion board.

I have a question: I have an .eml file (i can change the extension to .mhtml file or .mht file and it still renders in IE). I want to be able to present it to a user of my PHP-based website. Unfortunately, not everyone can read an .eml or .mht file, such as firefox users or mac users that don't use opera. I also don't want to force users to get a plug-in. Therefore I would like to convert the eml file to html or some kind of viewable format like that. It's a little tricky because you have to put the files somewhere - the internal inline references of EML files don't apply. is there something out there that does this? i haven't seen anything - there's a bunch of .NET utilities that do it but they all have a GUI and are .NET instead of PHP, whereas I need something that can work sans GUI within a PHP program. Is there maybe some clever way of using Manuel's classes that will do it that I haven't thought of (the url rewriting seems like it'd be problematic)?

  2. Re: EML/MHT/MHTML to HTML in PHP?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-06-09 05:28:06 - In reply to message 1 from Alex Tween
Using this MIME parser classes most of what you need is already done.

The class parses the messages in any of those formats because they are basically different names for the same format.

It retrieves each message part and you can render them in HTML pages as you like.

I just advise some care to filter off any Javascript in HTML message parts, otherwise you may subject your users to cross-site scripting exploits.