[RCD] How to fix incorrect CT-declaration "text/x-mail" for .eml attachments?
listuser at freexp.de
Wed Dec 26 21:38:43 CET 2012
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.
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".
That can't be true, really, so many lost days... Just because of this "-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:
1) Our system (Debian GNU/Linux 6.0 Squeeze) is using a compiled magic file
"/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.
2) I can find a plain (non-compiled) text file "/usr/share/mime/magic" on
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...?
3) The biggest of all mysteries: Where do the declaration "text/x-mail" and
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):
PHP test code is attached.
Thanks, cheers (and hoping for helpful hints and answers)
-------------- n?chster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
More information about the dev