wood burning stoves*
The moose likes Other JSE/JEE APIs and the fly likes i got problem with sending mail to yahoo using JavaMail API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "i got problem with sending mail to yahoo using JavaMail API" Watch "i got problem with sending mail to yahoo using JavaMail API" New topic
Author

i got problem with sending mail to yahoo using JavaMail API

Kirankumar Dangeti
Greenhorn

Joined: Mar 05, 2004
Posts: 2
Hi All
I got a problem with sending mail to yahoo
public class SendingMail {
public SendingMail() throws AddressException, MessagingException
{
String host = "smtp.mail.yahoo.com";
String from = "kirankumar_csit@yahoo.com";
String to = "kirankumar_dangeti@yahoo.com";
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance(props,null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject("Hello JavaMail");
message.setText("Welcome to JavaMail");
Transport.send(message);
System.out.println("Completed");

}

public static void main (String args[]) throws Exception {
SendingMail sm=new SendingMail();
}


}

I got The error below
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
at javax.mail.Transport.send0(Transport.java:219)
at javax.mail.Transport.send(Transport.java:81)
at SendingMail.<init>(SendingMail.java:33)
at SendingMail.main(SendingMail.java:39)
Exception in thread "main"

Can any one help to resolve the above problem
and i also need to send mails to any other mail server plz help to reslovet the problem
Xiao Ava
Greenhorn

Joined: Mar 26, 2004
Posts: 5
you need to authenticate yourself
example if you are the sender then your user name and password have to be authenticate according to the 'from' email service provider.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: i got problem with sending mail to yahoo using JavaMail API
 
Similar Threads
Program to send Email using JavaMail not working.
Using Java Mail Could not connect to SMTP Host
excveption in mail api please help
Send Mail problem
javamail jsp problem