| Author |
Couldn't send mail from gmail to yahoo.com
|
Rajasekhar Karanam
Greenhorn
Joined: Sep 18, 2011
Posts: 13
|
|
|
|
 |
Rajasekhar Karanam
Greenhorn
Joined: Sep 18, 2011
Posts: 13
|
|
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
Joined: Jul 26, 2007
Posts: 7602
|
|
Instead of java.net.PasswordAuthentication you should be using javax.mail.PasswordAuthentication
|
[Donate a pint, save a life!] [How to ask questions]
|
 |
Rob Spoor
Saloon Keeper
Joined: Oct 27, 2005
Posts: 18365
|
|
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.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Rajasekhar Karanam
Greenhorn
Joined: Sep 18, 2011
Posts: 13
|
|
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!
|
 |
 |
|
|
subject: Couldn't send mail from gmail to yahoo.com
|
|
|