[
https://issues.apache.org/jira/browse/MIME4J-282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16628452#comment-16628452
]
Stefano Bagnara commented on MIME4J-282:
----------------------------------------
You can encode to 30 chars length. Or you can even encode each line to a
different length as long as you don't go over 76 chars.
If you need to export the original message, then JUST export it as you read it
BEFORE parsing. Why on earth you want to "rebuild" a message when you already
have that message source?
"Rebuilding" expose YOU to legal problems. Just export the original message,
the one you had BEFORE parsing.. and you will be fine.
You don't use a parser if you need the message BEFORE it is parsed and you
can't expect a parser to give you back the original message. Simply store the
original message that you parsed if you need it.
I can only suggest you to avoid rebuilding (even if you switched to javamail)
because you will still break messages. If I send you a message using any tool
that embed mime4j then my ORIGINAL "dots" will be encoded in the original
encoded message. If you read it, decode it, and reencode it using javamail then
you will obtain a different message from the one I sent to you. QP let you
create almost infinite encoded representations of a give message, you can
simply "mimic" one way to encode it, but what you do is plain wrong.
> DefaultMessageWriter.writeMessage doesn't produces the same original eml
> ------------------------------------------------------------------------
>
> Key: MIME4J-282
> URL: https://issues.apache.org/jira/browse/MIME4J-282
> Project: James Mime4j
> Issue Type: Bug
> Components: dom
> Affects Versions: 0.8.1
> Reporter: Raffaele Gambelli
> Priority: Major
> Attachments: mirmps_1.eml, mirmps_1_mime4j.eml
>
>
> I'm using mime4j to parse messages starting from a javax.mail.Message.
> Then, my application needs to store in a String the original message too,
> that is the "eml", I did it in this way:
> {code:java}
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> MessageWriter writer = new DefaultMessageWriter();
> writer.writeMessage(message, baos);
> this.originalMessage = baos.toString();{code}
> Unfortunately I've seen that above code, does QP encoding so the final output
> is different from the original message.
> But in this way, the final eml results in a different eml from the original
> one, so for example the digital signature is not more valid.
> For example if you open the generated eml with a client like Outlook, it
> warns user that the digital signature is not valid.
> Now, I would like to know if exists a way to, starting from an eml generated
> with the above code, generate the correct version, so without QP encoding.
> Attached to this issue, I put an original eml and that one generated with
> above code, thanks
> Maybe this issue is related or caused to this other #MIME4J-186 ?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)