Forums Register Login

Getting SMTP transport error-Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 5

+Pie Number of slices to send: Send
I want to run a simple javamail program to send message to gmail using java program.but getting this error .kindly help me to solve this error and to execute this program properly.please let me know any changes is required in the program too.

here is the code..

output:
C:\Program Files\Java\jdk1.6.0_23\bin>javac MailExample.java

C:\Program Files\Java\jdk1.6.0_23\bin>java MailExample smtp.gmail.com keerth.kuruba@gmail.com keerthana.hari@gmail.com
Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1
Authentication Required. Learn more at
530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 lr4sm1384877
icb.20

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
829)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1368)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:886)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:120)
at MailExample.main(MailExample.java:33)
Here while running this program i have valid gmailids for from and to address..still getting the same error.
In the above error,one error link is there and gone through this link..but didnt get any thing.
+Pie Number of slices to send: Send
Did you notice that the error message states very precisely the reason for the error, and even provides a link to a more in-depth discussion of the problem?
+Pie Number of slices to send: Send
I have set mail.smtp.auth as true (props.put("mail.smtp.auth", "true"); ) then am getting some other error..as below


C:\Program Files\Java\jdk1.6.0_23\bin>javac MailExample.java

C:\Program Files\Java\jdk1.6.0_23\bin>java MailExample smtp.gmail.com keerth.kuruba@gmail.com keerthana.hari@gmail.com
Exception in thread "main" javax.mail.AuthenticationFailedException: failed to c
onnect, no password specified?
at javax.mail.Service.connect(Service.java:325)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at javax.mail.Transport.send0(Transport.java:190)
at javax.mail.Transport.send(Transport.java:120)
at MailExample.main(MailExample.java:34)

Here am sending samll message from one gmail id to another gmail id...then how to rectify this error
+Pie Number of slices to send: Send
How are you specifying username and password? Make sure you proceed according to http://www.oracle.com/technetwork/java/faq-135477.html#gmail

Once you are doing all of that, and it still doesn't work, post the code you have.
+Pie Number of slices to send: Send
Thanks a lot sir..... i have set the usename and password with this method PasswordAuthentication getPasswordAuthentication() in session.now it works fine...

If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 12966 times.
Similar Threads
Need some help me java mail-smtp
Sending mail with authentication to Exchange Server 2007
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
Give me solution to send mail
Send Mail problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:46:09.