Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

AutenticationFailedException  RSS feed

 
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: 17309
11
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!