Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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:
Return a decoded input stream for this Message's "content".
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:
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)