• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sample reading mails JavaMail

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I try to use JavaMail with GWT from read mails in a Gmail account but I have this error:

ERROR: javax.mail.NoSuchProviderException: Unable to locate provider for protocol: imaps

That is my code in server package:

public MyUserServiceImpl() {
String host = "imap.gmail.com";
String port = "993";
String user = "user@gmail.com";
String pass = "pass";

Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imaps");
props.setProperty("mail.imaps.host", host);
props.setProperty("mail.imaps.port", port);
props.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.setProperty("mail.imap.socketFactory.fallback", "false");

System.out.println("Definiendo...");
try{
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore();
store.connect(host, user, pass);
System.out.println("OK!");
}
catch(Exception e){
System.out.println("ERROR: " + e);
}
}

Thanks for the help.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic