class NotifyMailetsMessage {

    @VisibleForTesting static Optional<Long> getMessageSizeEstimation(Mail mail) {
        try  {
            return Optional.of(mail.getMessageSize())
                .filter(size -> size > 0);
        } catch (MessagingException e) {
            LOGGER.debug("Could not estimate mail size", e);

            return Optional.empty();
        }
    }

}