[RCD] How to fix incorrect CT-declaration "text/x-mail" for .eml attachments?

Alessandro Vesely vesely at tana.it
Sat Dec 29 12:29:53 CET 2012

On Sat 29/Dec/2012 01:24:24 +0100 Michael Heydekamp wrote:
> Am 27.12.2012 23:53, schrieb Michael Heydekamp:
>> Am 27.12.2012 10:10, schrieb A.L.E.C:
>> Second: Even if we assume that "Return-path:" is not RFC-compliant (I
>> didn't verify that)
> According to RFC 2821, it should indeed read "Return-Path:" (although the
> text itself contains a lot of matches also for "Return-path" and even
> "return-path", see https://www.ietf.org/rfc/rfc2821.txt).

The latest RFC specifies it in ABNF like so:

   Return-path-line  = "Return-Path:" FWS Reverse-path <CRLF>

while RFC 821 used BNF:

   <return-path-line> ::= "Return-Path:" <SP><reverse-path><CRLF>

In either case, strings are *case insensitive* and their character set

There are several difficulties.  Mail files are text files, but local
storage may provide for "\n"-terminated lines while transmission
requires "\r\n".  "Return-Path:" needs not be the very first line, as
"Delivered-To:" often happens to be inserted in front of it.
Non-delivered messages, e.g. those caught in some sending queue, need
not have a Return-Path at all.  In general, full rfc5322- and MIME-
compliance is hard --and useless-- to check.

Since mail is Roundcube's core business, I'd suggest some custom checks
to determine if an attachment is a mail file or headers thereof.  For
example, what are the key elements for displaying it properly?
Otherwise, libmagic maintainers might shred some light on the issue (are
they at http://www.darwinsys.com/file/?)

More information about the dev mailing list