• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i got problem with sending mail to yahoo using JavaMail API

 
Kirankumar Dangeti
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic