Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

connecting to gmail pop3 server

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi frnds,

I'm trying to connect with gmail pop server but it gives me following error...

DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
POP3: connecting to host "pop.gmail.com", port 995
S: EOF
C: QUIT
S: EOF
javax.mail.AuthenticationFailedException: EOF on socket
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:104)
at javax.mail.Service.connect(Service.java:234)
at FetchMail.main(FetchMail.java:17)
Exception in thread "main"



Source code:
---------------

import java.util.*;
import javax.mail.*;

public class FetchMail {

public static void main(String[] args) throws MessagingException {
String host = "pop.gmail.com";
String username = username";
String password = "password";

Properties props = new Properties();

Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);

Store store = session.getStore("pop3");
store.connect(host, 995, username, password);
Folder inbox=store.getDefaultFolder().getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
Message[] msg=inbox.getMessages();
FetchProfile profile=new FetchProfile();
profile.add(FetchProfile.Item.ENVELOPE);
inbox.fetch(msg,profile);
System.out.println(msg);
}
}



I wnat to ask can't we connect to public mail server using program?

-bhavin
 
Ranch Hand
Posts: 472
Objective C Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use SSL to connect to the server. Try a technique from this article:
http://www.javaworld.com/javatips/jw-javatip115.html

Please share with us your results. I can need this also.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having the same error. I used SSl, port 995, Server pop.gmail.com, but still I get not authenticated error. Unfortunately, I cant open up the class and have a look at the code, as I am calling the classes from Peoplesoft. Heres is the error log I received. Any help would be appreciated.

javax.mail.AuthenticationFailedException: EOF on socket
       at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:104)
       at javax.mail.Service.connect(Service.java:233)
       at com.peoplesoft.pt.integrationgateway.targetconnector.pop3.MCFMailBox.open(MCFMailBox.java:398)
       at com.peoplesoft.pt.integrationgateway.targetconnector.GetMailTargetConnector.processMessage(GetMailTargetConnector.java:620)
       at com.peoplesoft.pt.integrationgateway.targetconnector.GetMailTargetConnector.send(GetMailTargetConnector.java:135)
       at com.peoplesoft.pt.integrationgateway.service.BasicConnectorInvocator.execute(BasicConnectorInvocator.java:131)
       at com.peoplesoft.pt.integrationgateway.framework.GatewayManager.invokeService(GatewayManager.java:148)
       at com.peoplesoft.pt.integrationgateway.framework.GatewayManager.connect(GatewayManager.java:192)
       at com.peoplesoft.pt.integrationgateway.listeningconnector.PeopleSoftListeningConnector.doPost(PeopleSoftListeningConnector.java:186)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
       at com.peoplesoft.pt.integrationgateway.listeningconnector.PeopleSoftListeningConnector.service(PeopleSoftListeningConnector.java:87)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
       at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
       at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
       at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
       at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
       at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
       at com.peoplesoft.pt.integrationgateway.common.IBFilter.doFilter(IBFilter.java:84)
       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
       at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
       at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
       at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
       at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
       at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
       at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
       at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
       at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
       at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
       at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!