javax.mail.search.FromStringTerm Java Examples

The following examples show how to use javax.mail.search.FromStringTerm. 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 File: SearchTermBuilder.java    From greenmail with 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 File: MailConnection.java    From hop with 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 File: MailConnection.java    From pentaho-kettle with 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 ) );
    }
  }
}