javabee
javabee

Reputation: 85

Failed sending email with java program via smtp and ssl

I am just trying to send an email form java code. But I am getting exception like this:

"java.lang.RuntimeException: javax.mail.MessagingException: 
 Could not connect to SMTP host:smtp.gmail.com, port: 465, response: -1."

I have set the following properties:

mail.smtp.host
mail.smtp.socketFactory.port
mail.smtp.auth
mail.smtp.port

What is the reason for this exception?

Please help me. Thanks in advance.

Upvotes: 0

Views: 353

Answers (2)

Subhrajyoti Majumder
Subhrajyoti Majumder

Reputation: 41200

You could probably try this example to sort it out problem -

Java send mail through gmail

Upvotes: 1

Related Questions