*
The moose likes Other JSE/JEE APIs and the fly likes Program to send Email using JavaMail not working. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Program to send Email using JavaMail not working." Watch "Program to send Email using JavaMail not working." New topic
Author

Program to send Email using JavaMail not working.

v ray
Ranch Hand

Joined: Mar 15, 2007
Posts: 223
Hi guys,

Just trying out the javamail api for fun, am working with the program below:



And I am getting an exception which says:

Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
at set1.SimpleMail.main(SimpleMail.java:26)

What am I missing here? Any help will be really appreciated.

Thanks.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10

Does Yahoo grant you smtp access?

it doesn't do for me. I am not allowed to smtp or pop the Yahoo mail severs with my type of Yahoo mail account.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
v ray
Ranch Hand

Joined: Mar 15, 2007
Posts: 223
Can I use gmail instead?
v ray
Ranch Hand

Joined: Mar 15, 2007
Posts: 223
Turns out only yahoo plus provides this option, and gmail works.
This is the code I used and this version works fine:



This still throws an Exception at the end, although the email is sent. The exception thrown is:

DEBUG SMTP: exception reading response: javax.net.ssl.SSLException: Unsupported record version Unknown-50.49
Exception in thread "main" javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: Unsupported record version Unknown-50.49
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:645)
at javax.mail.Transport.send0(Transport.java:171)
at javax.mail.Transport.send(Transport.java:98)
at set1.mail3.sendSSLMessage(mail3.java:69)
at set1.mail3.main(mail3.java:28)
Caused by: javax.net.ssl.SSLException: Unsupported record version Unknown-50.49
at com.sun.net.ssl.internal.ssl.InputRecord.readV3Record(InputRecord.java:363)
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:348)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:720)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:677)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
... 5 more
Bren Zosa
Greenhorn

Joined: Aug 29, 2007
Posts: 1
try adding:

props.setProperty("mail.smtp.quitwait", "false");

Found that here: http://forum.java.sun.com/thread.jspa?threadID=5205249&tstart=30
[ August 29, 2007: Message edited by: Bren Zosa ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Program to send Email using JavaMail not working.