# Package javax.mail.search

package javax.mail.search

Message search terms for the Jakarta Mail API. This package defines classes that can be used to construct a search expression to search a folder for messages matching the expression; see the `search` method on `javax.mail.Folder`. See `SearchTerm`.

Note that the exact search capabilities depend on the protocol, provider, and server in use. For the POP3 protocol, all searching is done on the client side using the Jakarta Mail classes. For IMAP, all searching is done on the server side and is limited by the search capabilities of the IMAP protocol and the IMAP server being used. For example, IMAP date based searches have only day granularity.

In general, all of the string patterns supported by search terms are just simple strings; no regular expressions are supported.

Related Packages
Package
Description
javax.mail
The Jakarta Mail API provides classes that model a mail system.
javax.mail.event
Listeners and events for the Jakarta Mail API.
javax.mail.internet
Classes specific to Internet mail systems.
javax.mail.util
Jakarta Mail API utility classes.
Class
Description
AddressStringTerm
This abstract class implements string comparisons for Message addresses.
AddressTerm
This class implements Message Address comparisons.
AndTerm
This class implements the logical AND operator on individual SearchTerms.
BodyTerm
This class implements searches on a message body.
ComparisonTerm
This class models the comparison operator.
DateTerm
This class implements comparisons for Dates
FlagTerm
This class implements comparisons for Message Flags.
FromStringTerm
This class implements string comparisons for the From Address header.
FromTerm
This class implements comparisons for the From Address header.
HeaderTerm
This class implements comparisons for Message headers.
IntegerComparisonTerm
This class implements comparisons for integers.
MessageIDTerm
This term models the RFC822 "MessageId" - a message-id for Internet messages that is supposed to be unique per message.
MessageNumberTerm
This class implements comparisons for Message numbers.
NotTerm
This class implements the logical NEGATION operator.
OrTerm
This class implements the logical OR operator on individual SearchTerms.
ReceivedDateTerm
This class implements comparisons for the Message Received date
RecipientStringTerm
This class implements string comparisons for the Recipient Address headers.
RecipientTerm
This class implements comparisons for the Recipient Address headers.
SearchException
The exception thrown when a Search expression could not be handled.
SearchTerm
Search criteria are expressed as a tree of search-terms, forming a parse-tree for the search expression.
SentDateTerm
This class implements comparisons for the Message SentDate.
SizeTerm
This class implements comparisons for Message sizes.
StringTerm
This class implements the match method for Strings.
SubjectTerm
This class implements comparisons for the message Subject header.