On Fri, 10 Oct 2003, Slavo Uhrin wrote:
> What exactly should server do when fetching a message with invalid
> MIME header or body?

If you are talking about a message with RFC 2822 or MIME syntax errors,
the answer is:
        Garbage In, Garbage Out

The server may do whatever it wants.  If it wants, it can interpret bad
RFC 2822 syntax as instructions to reformat the hard drive.  I do not,
however, believe that such behavior is helpful; nor is returning a tagged
NO.

The most helpful behavior is to do a best effort at parsing the message,
return the results of that best effort, and finally return a tagged OK.

Think of it this way.  Suppose your MUA is reading a local mailbox file.
Do you think it is reasonable for the MUA to give an error message saying
"you can't read this message because it has a syntax error"?  Of course
not!

It's the same thing with IMAP.  The server should try its best, and make
as much data available as possible.

Note that the IMAP specification defines a [PARSE] code to note 2822/MIME
syntax errors.  This is so a client can decide whether or not to show such
error messages to the user.  This is typically sent as an untagged OK to
indicate that it is "babble" as opposed to a more serious error.

In summary, then, the preferred scenario is:

        C: 023 FETCH 1 ENVELOPE
        S: * OK [PARSE] Syntax error parsing cc header in message 1
        S: * 1 FETCH (ENVELOPE .....)
        S: 023 OK FETCH completed

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

Reply via email to