• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Couldn't send mail from gmail to yahoo.com

 
Greenhorn
Posts: 17
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Raja Sekhar Karanam
Greenhorn
Posts: 17
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of java.net.PasswordAuthentication you should be using javax.mail.PasswordAuthentication
 
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Raja Sekhar Karanam
Greenhorn
Posts: 17
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
I'm not sure if I approve of this interruption. But this tiny ad checks out:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic