On Nov 4, 2007 11:13 PM, Stefano Bagnara <[EMAIL PROTECTED]> wrote: > Robert Burrell Donkin ha scritto: > > [...] > > given a MimeMessage, i do not know how to determine whether the lines > > have been corrected as per RFC822 or not. ATM the MailboxAPI assumes > > that the mssage has not been normalised. it then performs a conversion > > to determine the length of the normalised content but then stores the > > actual content. on the way out, the API performs an automatic > > conversion of all body line endings to CRLF. > > The JavaDoc for MimeMessage.writeTo is: > * Output the message as an RFC 822 format stream. <p> > * > * Note that, depending on how the messag was constructed, it may > * use a variety of line termination conventions. Generally the > * output should be sent through an appropriate FilterOutputStream > * that converts the line terminators to the desired form, either > * CRLF for MIME compatibility and for use in Internet protocols, > * or the local platform's line terminator for storage in a local > * text file. <p> > > Javamail by default keeps the line terminators used in the inputstream > that built the message.
yep for the MailboxAPI to accurately store a MimeMessage, it really shouldn't fix the line endings > > this seems wrong to me. AIUI a message which has been normalised for > > internet transport may contain LFs and CRs in the body but these are > > not intended to indicate new body lines. the multiple conversion and > > calculations required to maintain this information degrades > > performance. it adds complexity to data storage. > > rfc2822: > ------ > 2.3. Body > > The body of a message is simply lines of US-ASCII characters. The > only two limitations on the body are as follows: > > - CR and LF MUST only occur together as CRLF; they MUST NOT appear > independently in the body. > > - Lines of characters in the body MUST be limited to 998 characters, > and SHOULD be limited to 78 characters, excluding the CRLF. > ----------- missed that 8-) thanks for correcting me :-) > CR and LF alone are not allowed also in headers (it is specified > somewhere else in the same RFC). > > IIRC currently our SMTPServer convert any CR and any LF (not already > coupled as CRLF) in a CRLF while reading it from the remote server. yes - so MailboxAPI should not need to perform any additional conversions in this case > > i now wonder whether it might be better if the API insisted that mail > > submitted were already normalised for RFC822 - any line ending > > conversions required by RFC822 for internet transport should be > > performed before storage. > > +1 > > Stefano > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
