java - How to get email messages not older than X seconds? -
i use code search through gmail inbox:
session session = session.getdefaultinstance(new properties()); store store = session.getstore("imaps"); store.connect("imap.googlemail.com", 993, email, password); folder emailfolder = store.getfolder("inbox"); emailfolder.open(folder.read_write); message[] messages = emailfolder.search(new andterm(new searchterm[] { new subjectterm(subject), new fromterm(new internetaddress(sender)), new youngerterm((int)timeunit.minutes.toseconds(3)) }));
but error:
javax.mail.messagingexception: a4 bad not parse command;
if remove youngerterm
search term, search call succeeds , returns messages, need reduce results adding youngerterm
filter.
the youngerterm class depends on imap extension gmail not support, rfc 5032. way want retrieve internaldate
, filter in client.
a bit strange javamail let create , send command uses youngerterm; surely ought know server reject it?
Comments
Post a Comment