You could also use the SearchTerm classes in the java mail package.
SearchTerm olderThan = new ReceivedDateTerm(ComparisonTerm.LT, someFutureDate);
SearchTerm newerThan = new ReceivedDateTerm(ComparisonTerm.GT, somePastDate);
SearchTerm andTerm = new AndTerm(olderThan, newerThan);
inbox.search(andTerm);
Some combination of the above should prove to be a better way to get dates within a certain range.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…