Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaMail with Gmail

 
Olivier Lemarra
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to send mail with Java Mail API on smtp of gmail.

Mail is sent ! But ... i got exception !

Here is my error :

Exception : javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 25;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? ; com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961) ;


And then here is my code :



I add that portServeurSMTP=587
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read http://www.oracle.com/technetwork/java/faq-135477.html#gmail?

One thing I notice is that your properties are smtp, not smtps. Try changing the prefixes to mail.smtps instead.
 
Olivier Lemarra
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Have you read http://www.oracle.com/technetwork/java/faq-135477.html#gmail?

One thing I notice is that your properties are smtp, not smtps. Try changing the prefixes to mail.smtps instead.


I read this.

I spent many (many) days changing many times properties ... (i checked all code available when using google).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic