This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes AutenticationFailedException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "AutenticationFailedException" Watch "AutenticationFailedException" New topic
Author

AutenticationFailedException

nsathishbabu nagarajan
Greenhorn

Joined: Jan 02, 2006
Posts: 6
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

Joined: Feb 05, 2001
Posts: 17276
    
    6


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


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AutenticationFailedException
 
It's not a secret anymore!