salut
je ne peux pas recevoir les mails que je les déja envoyer avac javaMail.
voici mon code
Code :
- Properties props1 = new java.util.Properties();
- props1.put("mail.transport.protocol",protocol);
- props1.put("mail." + protocol + ".host",host);
- props1.put("mail." + protocol + ".user",user_mail);
- props1.put("mail." + protocol + ".password",password_mail);
- // Test aut= new Test();
-
- Session session = javax.mail.Session.getDefaultInstance(props);//,aut);
- System.out.println("okkkkkkk1" );
- session.setDebug(true);
-
- try {
- Store store = session.getStore(protocol);
-
- store.connect(host,user_mail,password_mail);
-
- Folder folder = store.getFolder("INBOX" );
- if (folder == null) {
- System.out.println("No INBOX" );
- System.exit(1);
- }
- while(true)
- {
- System.out.println("okkkkkkk5" );
- folder.open(Folder.READ_ONLY);
- if(folder.isOpen()){
- Message[] message = folder.getMessages();
- System.out.println("okkkkkkk3" );
- for (int i = 0; i < message.length; i++) {
- System.out.println("------------ Message " + (i+1)
- + " ------------" );
-
- try{
-
- message[i].writeTo(System.out);
- }catch(IOException e){System.out.println("message non lu" );}
- }
-
- folder.close(false);
- store.close();
- }
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {System.out.println("ouch!\n" );}//e.printStackTrace();}
- }
-
- } catch (MessagingException e) {
- System.out.println(e.getMessage());
- }
|
et voici le résultat:
[resultat]
protocole=pop3
host=127.O.O.1
usermail=receiver@interfacage.com
password_mail=ss
okkkkkkk1
DEBUG: setDebug: JavaMail version 1.4ea
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
DEBUG POP3: connecting to host "127.O.O.1", port 110, isSSL false
Connect failed
[/resultat]