java - Not able to search the email server with searchTerm using Mail API -
an email sent lets gg@gg.com attachment 2 email id's .one, email id , xx@xx.com got email. when did mail search using java mail api email id search criteria , not able find though received email.but when forward same email id's search criteria working fine. please let me know when email received first time @ point why not able search
properties properties = system.getproperties(); properties.put("mail.smtp.host", exchangeproperties.getsmtphost()); properties.put("mail.pop3.connectiontimeout", string.valueof(exchangeproperties.getpop3connectiontimeout() * 1000)); properties.put("mail.pop3.timeout", string.valueof(exchangeproperties.getpop3timeout() * 1000)); session = session.getinstance(properties, null); session.setdebug(logger.isdebugenabled()); // store store = session.getstore("pop3"); store.connect(exchangeproperties.getsmtphost(), user, password); folder folder = store.getfolder(foldername) message[] foundmessages = folder.search(andterm); //andterm contains email id fetchprofile fp = new fetchprofile(); fp.add(fetchprofile.item.envelope); folder.fetch(foundmessages, fp);
since you're using pop3, searching done downloading messages client , searching them there. if want server searching, use imap.
if new message arrives while have pop3 folder open, won't able see it. need close folder , reopen it. that's limitation of pop3 protocol.
if none of helps problem, need know search term you're using, value you're searching for, , value appears in email header.
Comments
Post a Comment