james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raffaele Gambelli (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] [Commented] (MIME4J-282) DefaultMessageWriter.writeMessage doesn't produces the same original eml
Date Wed, 26 Sep 2018 08:48:00 GMT

    [ https://issues.apache.org/jira/browse/MIME4J-282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16628436#comment-16628436

Raffaele Gambelli commented on MIME4J-282:

In my scenario, I'm reading from users mailboxes, so I'm parsing those messages with mime4j,
then I need to "export eml", the raw message, the same feature that is present in any webmail
or mail client.
In this sense, mime4j produces a different eml from the original one, this difference then
breaks digital signature for all the certified messages, so it's big legal problem.

Saying differently, what should a mime4j user do to obtain the raw message (same bytes) of
a previously loaded message, from a org.apache.james.mime4j.dom.Message? 
It is not more a problem for me because I've definetely switched to javamail to re-obtain
the raw message.

You are surely free to interpret qp encoding, saying differently from the common way that
email providers do, but let me say that I find it quite strange and risky in situations like
this one I've described. 

{quote}There is no unique way to do the QP encoding (you can use the line length you prefer,
you can decide which char to encode or not.{quote}

Encoded lines must not be longer than 76 characters so you can't use what you prefer

> 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,
> Maybe this issue is related or caused to this other #MIME4J-186 ?

This message was sent by Atlassian JIRA

View raw message