Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Couldn't send mail from gmail to yahoo.com

 
Rajasekhar Karanam
Greenhorn
Posts: 16
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rajasekhar Karanam
Greenhorn
Posts: 16
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the error message:
Exception in thread "main" javax.mail.AuthenticationFailedException: failed to connect, no password specified?
at javax.mail.Service.connect(Service.java:329)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at GoogleToYahoo.main(GoogleToYahoo.java:39)
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm surprised this code even compiles. Line 29 should have given a compiler error due to incompatible return types - the only thing in commin between java.net.PasswordAuthentication and javax.mail.PasswordAuthentication is a) the name, and b) the purpose, although for different systems.

Edit: ah, now I see. The method in that piece of code isn't called getPasswordAuthentication but getPasswordAuthenticaton - missing the i. Adding an @Override annotation would have given that away directly.
 
Rajasekhar Karanam
Greenhorn
Posts: 16
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys!

I have used javax.mail.PasswordAuthentication and edited 3 mistakes
Line 12 smtp.gmail.com
Line 29 Authentication is corrected
Line 30 Password must be string!

And Now Its working! Thanks a lot!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic