# JavaMail: Unrecognized SSL message, plaintext connection?



## Gast (17. Nov 2008)

Hallo, 

Ich versuche per Javamail eine Verbindung zu pop3.web.de herzustellen um dort meine Mails abzurufen.

Code-Schnipsel:

```
Session session = Session.getInstance(props,
				new javax.mail.Authenticator() {
					@Override
					protected PasswordAuthentication getPasswordAuthentication() {
						return new PasswordAuthentication(props
								.getProperty("mail.pop3.user"), props
								.getProperty("mail.pop3.password"));
					}
				});
		// session.setDebug( true );
		// Verbindung herstellen
		
		Store store;
		logger.info("Verbinden mit POP3-Server...");
		try {
			store = session.getStore("pop3");
			try {
				store.connect();
				logger.info("Verbindung hergestellt...");
				Folder folder = store.getFolder("INBOX");
				folder.open(Folder.READ_WRITE);
				//Mails abrufen
				logger.info("Mails abrufen");
				message = folder.getMessages();
```

leider schmeißt mir das Ding bei store.connect() :


```
2008-11-17 12:39:39,056 [AWT-EventQueue-0] ERROR root - error while receiving mails: javax.mail.MessagingException: Connect failed;
  nested exception is:
	javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
javax.mail.MessagingException: Connect failed;
  nested exception is:
	javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
	at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:161)
	at javax.mail.Service.connect(Service.java:310)
	at javax.mail.Service.connect(Service.java:169)
	at javax.mail.Service.connect(Service.java:118)
	at MailManager.getMailToFolder(MailManager.java:53)
	at ServerJob.run(ServerJob.java:49)
	at Control.startServerJob(Control.java:20)
	at GUI.startServerJob(GUI.java:171)
	at GUI$1.actionPerformed(GUI.java:117)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
	at java.awt.Component.processMouseEvent(Component.java:6134)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
	at java.awt.Component.processEvent(Component.java:5899)
	at java.awt.Container.processEvent(Container.java:2023)
	at java.awt.Component.dispatchEventImpl(Component.java:4501)
	at java.awt.Container.dispatchEventImpl(Container.java:2081)
	at java.awt.Component.dispatchEvent(Component.java:4331)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
	at java.awt.Container.dispatchEventImpl(Container.java:2067)
	at java.awt.Window.dispatchEventImpl(Window.java:2458)
	at java.awt.Component.dispatchEvent(Component.java:4331)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
	at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:523)
	at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:355)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:744)
	at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
	at java.io.DataInputStream.readLine(DataInputStream.java:496)
	at com.sun.mail.pop3.Protocol.simpleCommand(Protocol.java:360)
	at com.sun.mail.pop3.Protocol.<init>(Protocol.java:104)
	at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:214)
	at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:157)
	... 33 more
```

Hilfe wäre toll, ist Teil meines Abschlussprojektes. Das das Mittwoch abgegeben werden muss, erwähne ich lieber nicht :x[/code]


----------



## HoaX (17. Nov 2008)

willst du denn per ssl verbinden? hast du die factory dafür angepasst? falscher port?


----------



## Gast (17. Nov 2008)

Wie geht das mit der Factory?  :shock:


----------



## Gast (20. Nov 2008)

Gast hat gesagt.:
			
		

> Wie geht das mit der Factory?  :shock:



wüste ich auch gern


----------

