Search in sources :

Example 11 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method text.

/**
	 * Defines filter on a message body.
	 * All parts of the message that are of MIME type "text/*" are searched.
	 */
public EmailFilter text(String pattern) {
    SearchTerm term = new BodyTerm(pattern);
    concat(term);
    return this;
}
Also used : BodyTerm(javax.mail.search.BodyTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 12 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method size.

/**
	 * Defines filter for message size.
	 */
public EmailFilter size(Operator comparison, int size) {
    SearchTerm term = new SizeTerm(comparison.value, size);
    concat(term);
    return this;
}
Also used : SizeTerm(javax.mail.search.SizeTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 13 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method from.

/**
	 * Defines filter for FROM field.
	 */
public EmailFilter from(String fromAddress) {
    SearchTerm fromTerm = new FromStringTerm(fromAddress);
    concat(fromTerm);
    return this;
}
Also used : FromStringTerm(javax.mail.search.FromStringTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 14 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method receivedDate.

/**
	 * Defines filter for received date.
	 */
public EmailFilter receivedDate(Operator operator, long milliseconds) {
    SearchTerm term = new ReceivedDateTerm(operator.value, new java.util.Date(milliseconds));
    concat(term);
    return this;
}
Also used : ReceivedDateTerm(javax.mail.search.ReceivedDateTerm) SearchTerm(javax.mail.search.SearchTerm)

Example 15 with SearchTerm

use of javax.mail.search.SearchTerm in project jodd by oblac.

the class EmailFilter method bcc.

/**
	 * Defines filter for BCC field.
	 */
public EmailFilter bcc(String bccAddress) {
    SearchTerm toTerm = new RecipientStringTerm(Message.RecipientType.BCC, bccAddress);
    concat(toTerm);
    return this;
}
Also used : RecipientStringTerm(javax.mail.search.RecipientStringTerm) SearchTerm(javax.mail.search.SearchTerm)

Aggregations

SearchTerm (javax.mail.search.SearchTerm)38 RecipientStringTerm (javax.mail.search.RecipientStringTerm)9 FromStringTerm (javax.mail.search.FromStringTerm)8 Test (org.junit.Test)8 OrTerm (javax.mail.search.OrTerm)6 SubjectTerm (javax.mail.search.SubjectTerm)6 AndTerm (javax.mail.search.AndTerm)5 Message (javax.mail.Message)3 InternetAddress (javax.mail.internet.InternetAddress)3 MimeMessage (javax.mail.internet.MimeMessage)3 FlagTerm (javax.mail.search.FlagTerm)3 HeaderTerm (javax.mail.search.HeaderTerm)3 NotTerm (javax.mail.search.NotTerm)3 IMAPFolder (com.sun.mail.imap.IMAPFolder)2 Date (java.util.Date)2 Flags (javax.mail.Flags)2 MessagingException (javax.mail.MessagingException)2 BodyTerm (javax.mail.search.BodyTerm)2 MessageIDTerm (javax.mail.search.MessageIDTerm)2 ReceivedDateTerm (javax.mail.search.ReceivedDateTerm)2