Código
private SearchTerm SearchTerm = new SubjectTerm("Informe Virtual"); // Deshabilitamos TLS P.setProperty("mail.pop3.starttls.enable", "false"); // Hay que usar SSL P.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); P.setProperty("mail.pop3.socketFactory.fallback", "false"); // Puerto 995 para conectarse. P.setProperty("mail.pop3.port","995"); P.setProperty("mail.pop3.socketFactory.port", "995"); Session Session = javax.mail.Session.getInstance(P); Session.setDebug(true); try{ Store Store = Session.getStore("pop3"); Store.connect("pop.gmail.com", Direccion, Contraseña); Folder Folder = Store.getFolder("INBOX"); Folder.open(javax.mail.Folder.READ_ONLY); Message[] Messages = Folder.search(SearchTerm); for(int i = 0; i<Messages.length; i++){ } e.printStackTrace(); } } }