Hi,
I am writing a program to send an email from
java but i'm unable to send it i'm getting an error. the code and details are as below.
while executing this i get the below error.
Exception in thread "main" java.lang.RuntimeException: javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at mail_j.PlainTextEmailSender.main(PlainTextEmailSender.java:39)
Caused by: javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at javax.mail.Transport.send0(Transport.java:219)
at javax.mail.Transport.send(Transport.java:81)
at mail_j.PlainTextEmailSender.main(PlainTextEmailSender.java:34)
Java Result: 1
BUILD SUCCESSFUL (total time: 42 seconds)
i'm getting the same error even if i use port number 587 and 25
Thanks