You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by "Justin McCartney (JIRA)" <mi...@james.apache.org> on 2014/01/28 18:17:39 UTC

[jira] [Created] (MIME4J-236) Valid email with MIME part encoded as quoted printable is flagged as invalid

Justin McCartney created MIME4J-236:
---------------------------------------

             Summary: Valid email with MIME part encoded as quoted printable is flagged as invalid
                 Key: MIME4J-236
                 URL: https://issues.apache.org/jira/browse/MIME4J-236
             Project: James Mime4j
          Issue Type: Bug
          Components: parser (core)
    Affects Versions: 0.7.2
            Reporter: Justin McCartney


I was using Mime4j to validate some emails supplied through an API to one of our internal systems.  Strict parsing was set to true.

Here is the behaviour of Mime4j that is I feel incorrect in QuotedPrintableInputStream.

A text file used as an inline attachment:

Content-Type: text/plain; charset=Cp1252
Content-Transfer-Encoding: quoted-printable

The second line below causes an error.  For clarity's sake I have added the the new line characters as CR and LF.

<?xml version=3D"1.0" standalone=3D"no"?>CRLF
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/=CRLF
SVG/1.1/DTD/svg11.dtd" >CRLF

The stack trace of the error:

Caused by: java.io.IOException: Found LF without CR
at org.apache.james.mime4j.codec.QuotedPrintableInputStream.read0(QuotedPrintableInputStream.java:194)
at org.apache.james.mime4j.codec.QuotedPrintableInputStream.read(QuotedPrintableInputStream.java:306)
at java.io.InputStream.read(InputStream.java:101)
at org.apache.james.mime4j.message.BasicBodyFactory.bufferContent(BasicBodyFactory.java:53)
at org.apache.james.mime4j.message.BasicBodyFactory.textBody(BasicBodyFactory.java:43)
at org.apache.james.mime4j.message.EntityBuilder.body(EntityBuilder.java:151)
at org.apache.james.mime4j.parser.MimeStreamParser.parse(MimeStreamParser.java:133)
at org.apache.james.mime4j.message.DefaultMessageBuilder.parseMessage(DefaultMessageBuilder.java:311)

I believe that second line in my example is correct.  It was created by Sun's com.sun.mail.util.QPEncoderStream.

The equals indicates a soft line break and the following CRLF is the valid new line marker for the mail message.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)