/** * Defines filter on a message body. * All parts of the message that are of MIME type "text/*" are searched. * * @param pattern String pattern use in body. * @return this */ public EmailFilter text(final String pattern) { final SearchTerm term = new BodyTerm(pattern); concat(term); return this; }
/** * Search all messages with body containing the word bodyfilter * * @param bodyfilter * @param notTerm * negate condition */ public void setBodyTerm( String bodyfilter, boolean notTerm ) { if ( !Utils.isEmpty( bodyfilter ) ) { if ( notTerm ) { addSearchTerm( new NotTerm( new BodyTerm( bodyfilter ) ) ); } else { addSearchTerm( new BodyTerm( bodyfilter ) ); } } }
public SearchTermBuilder body(Op op, String pattern) { SearchTerm st = new BodyTerm(pattern); addTerm(op, st); return this; }
/** * Defines filter on a message body. * All parts of the message that are of MIME type "text/*" are searched. * * @param pattern String pattern use in body. * @return this */ public EmailFilter text(final String pattern) { final SearchTerm term = new BodyTerm(pattern); concat(term); return this; }
Folder mailFolder = store.getFolder(folder); mailFolder.open(Folder.READ_WRITE); SearchTerm st = new AndTerm(new SubjectTerm(subject), new BodyTerm(subject)); Message[] messages = mailFolder.search(st); for (Message message : messages) {
@Override public SearchTerm build() { String query = getParameters().get(0); SearchTerm[] terms = { new RecipientStringTerm(Message.RecipientType.TO, query), new RecipientStringTerm(Message.RecipientType.CC, query), new RecipientStringTerm(Message.RecipientType.BCC, query), new FromStringTerm(query), new SubjectTerm(query), new BodyTerm(query) }; return new OrTerm(terms); } };
if (((JavaMailGmailMessage)message).getMessage().match(new BodyTerm(value))) { matchedEmails.add(message);
SearchTerm subjectTerm = new SubjectTerm(searchString); SearchTerm fromTerm = new FromStringTerm(searchString); SearchTerm bodyTerm = new BodyTerm(searchString); SearchTerm orTerm = new OrTerm(new SearchTerm[] { subjectTerm, fromTerm, bodyTerm });
break; case KEYWORD: seekStrategy = new BodyTerm(value); LOG.debug("Fetching emails containing the keyword \"" + value + "\""); break;