• 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

i got problem with sending mail to yahoo using JavaMail API

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
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