Hallo,
der Ausschnitt aus einem größeren Programm soll eine Verbindung mithilfe von JavaMail zu einem web.de-Account erzeugen:
Ausgabe lautet:
Google spuckt keine brauchbare Lösung aus.
Kann jemand helfen?
der Ausschnitt aus einem größeren Programm soll eine Verbindung mithilfe von JavaMail zu einem web.de-Account erzeugen:
Java:
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class MailTest {
// Objekte
private String protocol,host,user,pw;
private Properties props;
private Session session;
private Store store;
public MailTest() {
protocol = "imap";
host = "smtp.web.de";
user = "***";
pw = "***";
try {
// Ein Properties-Objekt erzeugen
props = System.getProperties();
// Mail-Host hinzufuegen
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", "587");
props.put("mail.smtp.starttls.enable", "true");
//Authentifikation
MailAuthenticator auth = new MailAuthenticator(user, pw);
props.put("mail.smtp.auth", "true");
//ESMTP
props.put("mail.smtp.allow8bitmime", "true");
// Ein Session-Objekt erzeugen
session = Session.getDefaultInstance(props, auth);
session.setDebug(true);
// Ein Store-Objekt erzeugen
store = session.getStore(protocol);
// Verbindung herstellen
store.connect(host,587, user, pw);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
public static void main(final String[] args) {
new MailTest();
}
}
Ausgabe lautet:
Code:
DEBUG: setDebug: JavaMail version 1.5.6
DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle]
DEBUG IMAP: mail.imap.fetchsize: 16384
DEBUG IMAP: mail.imap.ignorebodystructuresize: false
DEBUG IMAP: mail.imap.statuscachetimeout: 1000
DEBUG IMAP: mail.imap.appendbuffersize: -1
DEBUG IMAP: mail.imap.minidletime: 10
DEBUG IMAP: closeFoldersOnStoreFailure
DEBUG IMAP: trying to connect to host "smtp.web.de", port 587, isSSL false
220 web.de (mrweb002) Nemesis ESMTP Service ready
javax.mail.MessagingException: 220 web.de (mrweb002) Nemesis ESMTP Service ready;
nested exception is:
com.sun.mail.iap.ConnectionException: 220 web.de (mrweb002) Nemesis ESMTP Service ready
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:731)
at javax.mail.Service.connect(Service.java:366)
at MailTest.<init>(mailTest.java:53)
at MailTest.main(mailTest.java:62)
Caused by: com.sun.mail.iap.ConnectionException: 220 web.de (mrweb002) Nemesis ESMTP Service ready
at com.sun.mail.imap.protocol.IMAPProtocol.processGreeting(IMAPProtocol.java:321)
at com.sun.mail.iap.Protocol.<init>(Protocol.java:130)
at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:126)
at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:756)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:691)
... 3 more
Google spuckt keine brauchbare Lösung aus.
Kann jemand helfen?