You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Benoit Tellier (Jira)" <se...@james.apache.org> on 2020/05/11 06:50:00 UTC

[jira] [Created] (JAMES-3178) AutomaticSentMail detector should bypass javax.mail parsing

Benoit Tellier created JAMES-3178:
-------------------------------------

             Summary: AutomaticSentMail detector should bypass javax.mail parsing
                 Key: JAMES-3178
                 URL: https://issues.apache.org/jira/browse/JAMES-3178
             Project: James Server
          Issue Type: Improvement
          Components: Mailet Contributions
            Reporter: Benoit Tellier


We rely on `mime4j` for mail content parsing, we should bypass the implicit parsing and sanitizing performed in `MimeMessage::getInputStream`.

As the JavaX.mail javadoc says:

{code:java}
Return a decoded input stream for this Message's "content".
{code}

To do so, we can use MimeMessageInputStream in james-server-core, wich also implies relocating `AutomaticallySentMailDetectorImpl`.

Note that javax parsing is less robust than mime4j one, leading to the following exception:


{code:java}
javax.mail.MessagingException: Can not read content
	at org.apache.mailet.base.AutomaticallySentMailDetectorImpl.isMdnSentAutomatically(AutomaticallySentMailDetectorImpl.java:107)
	at org.apache.mailet.base.AutomaticallySentMailDetectorImpl.isAutomaticallySent(AutomaticallySentMailDetectorImpl.java:54)
	at org.apache.james.jmap.mailet.VacationMailet.service(VacationMailet.java:72)
	at org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:77)
[...]
Caused by: java.io.IOException: Unknown encoding: 8bitMIME-version
	at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:116)
	at javax.activation.DataHandler.getInputStream(DataHandler.java:238)
	at javax.mail.internet.MimeMessage.getInputStream(MimeMessage.java:1395)
	at org.apache.james.server.core.MimeMessageCopyOnWriteProxy.getInputStream(MimeMessageCopyOnWriteProxy.java:265)
	at org.apache.mailet.base.AutomaticallySentMailDetectorImpl.isMdnSentAutomatically(AutomaticallySentMailDetectorImpl.java:103)
	... 92 common frames omitted
Caused by: javax.mail.MessagingException: Unknown encoding: 8bitMIME-version
	at javax.mail.internet.MimeUtility.decode(MimeUtility.java:405)
	at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:109)
{code}





--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org