[
https://issues.apache.org/jira/browse/MAILET-166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matthieu Baechler closed MAILET-166.
------------------------------------
Resolution: Fixed
Fixed by https://github.com/linagora/james-project/pull/3337
> AutomaticSentMail detector should not fail for mails of more than one MB
> ------------------------------------------------------------------------
>
> Key: MAILET-166
> URL: https://issues.apache.org/jira/browse/MAILET-166
> Project: James Mailet
> Issue Type: Improvement
> Components: Base Mailets
> Affects Versions: 3.5.0
> Reporter: Benoit Tellier
> Priority: Major
> Fix For: 3.6.0
>
>
> We encountered the following error:
> {code:java}
> java.io.IOException: Input stream limit exceeded
> at
> org.apache.james.mime4j.io.LimitedInputStream.enforceLimit(LimitedInputStream.java:39)
> at
> org.apache.james.mime4j.io.LimitedInputStream.read(LimitedInputStream.java:51)
> at java.io.FilterInputStream.read(FilterInputStream.java:107)
> at
> org.apache.james.mime4j.stream.MimeEntity.advanceToBoundary(MimeEntity.java:393)
> ...
> Wrapped by: 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:75)
> at
> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:176)
> at
> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:153)
> at
> org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
> {code}
> Vacation mailet calls AutomaticallySentMailDetector
> AutomaticallySentMailDetectorImpl::isMdnSentAutomatically do calls MDN
> parsing.
> ```
> @Override
> public boolean isAutomaticallySent(Mail mail) throws MessagingException {
> return !mail.hasSender() ||
> isMailingList(mail) ||
> isAutoSubmitted(mail) ||
> isMdnSentAutomatically(mail);
> }
> ```
> And...
> ```
> @Override
> public boolean isMdnSentAutomatically(Mail mail) throws
> MessagingException {
> ResultCollector resultCollector = new ResultCollector(false);
> MimeStreamParser parser = new MimeStreamParser(MimeConfig.custom()
> .setMaxContentLen(1024 * 1024) // there's no reason for a mdn
> report to be bigger than 1MiB
> .setMaxHeaderCount(-1)
> .setMaxHeaderLen(-1)
> .setMaxLineLen(-1)
> .setHeadlessParsing(mail.getMessage().getContentType())
> .build());
> parser.setContentHandler(createMdnContentHandler(resultCollector));
> try {
> parser.parse(mail.getMessage().getInputStream());
> } catch (MimeException e) {
> throw new MessagingException("Can not parse Mime", e);
> } catch (IOException e) {
> throw new MessagingException("Can not read content", e);
> }
> return resultCollector.getResult();
> }
> ```
> I see a pretty good reason for an MDN mail to be bigger than 1Mb ;-)
> So in short, please:
> - Write an integration test showing that vacation do not work for a mail
> bigger than one MB
> - Fix it!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)