Java Code Examples for javax.mail.search.FromStringTerm

The following examples show how to use javax.mail.search.FromStringTerm. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: greenmail   Source File: SearchTermBuilder.java    License: Apache License 2.0 6 votes vote down vote up
private static SearchTermBuilder createTextSearchTermBuilder() {
    return new SearchTermBuilder() {
        @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);
        }
    };
}
 
Example 2
Source Project: hop   Source File: MailConnection.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Set filter on message sender.
 *
 * @param sender  messages will be filtered on sender
 * @param notTerm negate condition
 */
public void setSenderTerm( String sender, boolean notTerm ) {
  if ( !Utils.isEmpty( sender ) ) {
    if ( notTerm ) {
      addSearchTerm( new NotTerm( new FromStringTerm( sender ) ) );
    } else {
      addSearchTerm( new FromStringTerm( sender ) );
    }
  }
}
 
Example 3
Source Project: pentaho-kettle   Source File: MailConnection.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Set filter on message sender.
 *
 * @param sender
 *          messages will be filtered on sender
 * @param notTerm
 *          negate condition
 */
public void setSenderTerm( String sender, boolean notTerm ) {
  if ( !Utils.isEmpty( sender ) ) {
    if ( notTerm ) {
      addSearchTerm( new NotTerm( new FromStringTerm( sender ) ) );
    } else {
      addSearchTerm( new FromStringTerm( sender ) );
    }
  }
}