Javamail - AOL-IMAP-Postfach abholen

  • Themenstarter Themenstarter Mr. X-Max
  • Beginndatum Beginndatum
Status
Nicht offen für weitere Antworten.
M

Mr. X-Max

Gast
Hallo!

Ich möchte gerne ein AOL-IMAP-Postfach abholen lassen. Ich hab auch schon einiges rumprobiert, aber nicht wirklich was hinbekommen. Was muss ich der Reihe nach programmieren, dass es klappt?

Ciao MAX
 
Das ist garnicht so einfach zu rekonstruieren...

Mein letzter Entwurf sah so aus:
Code:
String host = "imap.aim.com";
String user = <username>;
String pass = <passwort>;
String port = "143";
    
Properties props = System.getProperties(); 
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
    
Session session = Session.getDefaultInstance(props);
Store store = session.getStore("imap");
store.connect(host, user, pass);
    
store.close();

Die Exception dabei ist:
javax.mail.MessagingException: Couldn't connect using "javax.net.ssl.SSLSocketFactory" socket factory to host, port: imap.aim.com, -1; Exception: java.lang.reflect.InvocationTargetException;
nested exception is:
java.io.IOException: Couldn't connect using "javax.net.ssl.SSLSocketFactory" socket factory to host, port: imap.aim.com, -1; Exception: java.lang.reflect.InvocationTargetException
 
Also zum Abholen der Mails verwendest Du SMTP...das sollte hier aber entweder POP oder IMAP sein.

Probier mal:

Code:
props.put("mail.imap.host", host);
props.put("mail.imap.port", port); 
props.put("mail.debug", "true");

Und zum Auslesen der Mails aus einem Folder:

Code:
folder = store.getFolder("INBOX");
folder.open(Folder.READ_WRITE);

Message[] messages = folder.getMessages();
...
 
Stimmt 🙂 blöder Fehler... Habs ausgebessert.

Jetzt kommt folgende Fehlermeldung:
javax.mail.MessagingException: Connection timed out: connect;
nested exception is:
java.net.ConnectException: Connection timed out: connect
 
DEBUG: not loading system providers in <java.home>/lib

DEBUG: not loading optional custom providers file: /META-INF/javamail.providers

DEBUG: successfully loaded default providers

DEBUG: Tables of loaded providers

DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}

DEBUG: Providers Listed By Protocol: {imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}

DEBUG: not loading optional address map file: /META-INF/javamail.address.map

DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc]

javax.mail.MessagingException: Connection timed out: connect;
nested exception is:
java.net.ConnectException: Connection timed out: connect
 
Es kommt also kein Verbindungsaufbau zu stande.

Prüfen:
- Kann ich den Host anpingen? ("ping imap.aim.com" in Shell)
- Sind meine Daten korrekt? Username (bei AIM glaub nur der Nick, ohne @aim.com), Passwort?
- Muss ich evtl. SSL verwenden?

Ansonsten schau Dir mal den Source-Code hier an:
Apache ServiceMix Mail Binding.

Eventuell kommst Du ja so weiter.
 
Status
Nicht offen für weitere Antworten.

Neue Themen


Zurück
Oben