We're working and testing on this issue for days in the meantime, but to no avail. The issue is:
Our system is returning "text/x-mail" (rather than "message/rfc822", how it would be expected) when we throw the PHP function 'finfo_open' against a valid e-mail file, which has been saved locally with Roundcube, starting with a line "Return-path:". Therefore and logically Roundcube is declaring ""text/x-mail" when attaching this .eml to an e-mail, which does prevent Roundcube from handling and rendering the attchment as an e-mail.
But, ha...!
You won't probably believe it, but while typing this and after days of research in the net and just looking at the .eml again, it occurs to me, that we can "solve" the problem by changing "Return-path:" to "Return-Path:" in the first line of the .eml source file. All of a sudden the .eml file is correctly detected as "message/rfc822".
Arrgh!?
That can't be true, really, so many lost days... Just because of this "-p" vs. "-P"?!
The message that we were using for testing has apparently been composed with the Google webmailer (which does for whatever reason not set any of the several MUA headers being around, I can just assume this from other headers such as "X-Google-Sender-Auth:").
Anyway, there are still a number of questions open then:
"/usr/share/magic.mgc" with a file size of 1.830.800 Byte, which apparently supports "Return-Path:", but not "Return-path:". Is there any other magic.mgc around which does also support "Return-path:" and which is compatible with our system?
This question arises because I tried to use a magic.mgc which is bundled with the Linux command 'file' 5.11 (while the original 'file' version of Squeeze is 5.04), but we get an error if we try to open it with 'finfo_open()'. Apparently this magic.mgc does also not support "Return-path:" (because it doesn't contain that string), but this experience shows that you can't use any arbitrary magic.mgc found somewhere.
our system which does apparently support both "Return-Path:" and "Return-path:", but we're getting an error when trying to load it with 'finfo_open'. This is surprising in so far as we can load another plain (also non-compiled) plain text file "/etc/apache2/magic" without a problem (but which does unfortunately also not support "Return-path:", so it doesn't really help as well, unless being edited).
Any idea why 'finfo_open' can load some plain text (non-compiled) magic files, but others not...?
the description "ASCII mail text" in the case of "Return-path:" come from at all? These strings are not contained in any of the several (compiled or non-compiled) magic files.
Any useful hints most appreciated!
Ah, and please: Don't advise to add ".eml" to Roundcube's mimetypes.php. We're aware of that, but according to Thomas advice, this is not the right way to go.
To check the difference between the result of an .eml with "Return-Path:" and with "Return-path:", just click on the following link (it may not last forever, so don't be too surprised if it should not work years later):
http://srv217.dedi64.de/mime_test/mime_test.php
PHP test code is attached.
Michael Heydekamp Co-Admin freexp.de Düsseldorf/Germany