File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes JavaMail with Gmail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JavaMail with Gmail" Watch "JavaMail with Gmail" New topic
Author

JavaMail with Gmail

Olivier Lemarra
Greenhorn

Joined: Mar 21, 2011
Posts: 6
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

Joined: Oct 27, 2005
Posts: 19651
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Olivier Lemarra
Greenhorn

Joined: Mar 21, 2011
Posts: 6
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).
 
Consider Paul's rocket mass heater.
 
subject: JavaMail with Gmail
 
Similar Threads
Problem in Mail Attachemnt using JSP
How to embed image (relative path) in an HTML e-mail?
setting content in email with attachment JavaMail
Java Mail
Sending MAIL by Java