Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AutenticationFailedException

 
nsathishbabu nagarajan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

When i try to run the javamail program form the server,it failsby giving the error authenticationfailedexception.this is the program i am using....

String host="hostname";
String from="name@company.com";
String to="name1@company.com;
Properties prop = System.getProperties();
prop.put("mail.transport.protocol","smtp");
prop.put("mail.smtp.host",host);
prop.put("mail.transport.port","25");
prop.put("mail.smtp.auth","true");
prop.put("mail.smtp.user","username");
prop.put("mail.smtp.password","password");
Session ses = Session.getInstance(prop,null);
Message msg= new MimeMessage(ses);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO,new InternetAddress(to));
msg.setSubject("subject");
Transport.send(msg);
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

prop.put("mail.smtp.auth","true");
prop.put("mail.smtp.user","username");
prop.put("mail.smtp.password","password");


Sorry for the obvious question, but is that your real username and password that you are using and passing, or just to protect, from this forum, the actual ones?

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic