Red Hat Bugzilla – Bug 137705
Saving a message with "From ..." or ">From ..." in the headers without a colon in that line reports "Message contains invalid header"
Last modified: 2007-11-30 17:10:53 EST
Description of problem:
When saving a message from a MUA such as Mozilla Mail that contains at
least one line like any of the following two lines, the server returns
an error saying "Message contains invalid header"
From liboe@linux Sun Jun 11 19:48:24 2000
>From - Sat Oct 30 11:46:51 2004
I'm not sure when this strange From line gets added, but it happened
on a message that I received through cyrus-imapd correctly that I
moved to my Mozilla Mail archive. When I tried to copy or move that
message back to cyrus-imapd, the server prevented it with the "Message
contains invalid header" message. Most messages that I archive in the
same manner from the same server don't have the strange From line
added, though some do. In all cases, a validly-formed From: line also
exists, making the invalid From line unnecessary. The specifics of
what creates a strange From line are unknown to me, and more research
may be necessary.
I searched Google and found that people in the past had run into this
and came up with solutions ranging from `grep -v`ing their mbox files
to changing message.c to accept the space character as valid when
validating the header. While I could have filed a bug with Mozilla to
strip out the strange From and >From lines when saving to IMAP, I
opted to patch cyrus-imapd instead to accept those two special cases
while preventing spaces in other header names.
Here are some historical references to this bug:
From the referenced sources above, it looks like this may affect other
MUAs as well.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Using a MUA (I used Mozilla Mail 1.7.2), copy or move a message
containing a "From " or ">From " line in the header without a colon in
that line to a cyrus-imapd folder
Actual Results: Operation fails with "Message contains invalid header"
Expected Results: Message gets copied or moved properly, depending on
what the operation was.
I created a patch that special-cases "From " and ">From " as valid
header lines. Ideally, this should be fixed upstream, though at least
the patch can have a home for now.
Created attachment 105986 [details]
Patch that accepts "From " and ">From " as valid header lines
Created attachment 105987 [details]
Spec file with the patch included
I'm guessing that this patch may be an optional rpm-build-time parameter like
the others in the RPM, though it would be nice if it makes it into the
I confirm this bug, which is a bit annoying as it prevents some users to
manually migrate messages to the cyrus imap server.
The RFC 2060 (IMAP4v1) says that the literal argument to APPEND SHOULD be in
RFC 822 (Standard for ARPA Internet Text Messages, superseded by 2822,
Internet Message Format) format. However, neither RFC 822 nor 2822 allows
the From or >From line without colon.
As for exception to this (should) rule, rfc says:
Note: There MAY be exceptions, e.g. draft messages, in which
required [RFC-822] header lines are omitted in the message literal
argument to APPEND. The full implications of doing so MUST be
understood and carefully weighed.
However, nothing is said about leading From lines. These lines most probably
come from mbox files (as described in RFC 4155). So this is really a
non-conforming behaviour on the part of the client. I would suggest filing
bugs against the MUAs in question.
I agree. I actually had stopped using this patch as Thunderbird appears to not
exhibit this behavior anymore. So I'm totally okay with this [not-a-]bug being