class FetchedFrom extends GenericMatcher {

    @Override
    public Collection<MailAddress> match(Mail mail) throws MessagingException {
        MimeMessage message = mail.getMessage();
        String fetchHeaderValue = message.getHeader(X_FETCHED_FROM, null);
        if (Objects.equal(fetchHeaderValue, getCondition())) {
            mail.getMessage().removeHeader(X_FETCHED_FROM);
            return mail.getRecipients();
        }
        return null;
    }

}