File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes mail sending failed using java mail api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "mail sending failed using java mail api" Watch "mail sending failed using java mail api" New topic
Author

mail sending failed using java mail api

Sidhartha Ray
Greenhorn

Joined: Jul 04, 2012
Posts: 29
Hi all,
I'm using Java mail API for sending mail with some zip file attachments.
It's working fine, but one issue : when one autherisation fails then the subsequent mail sending also fails.
i.e., say one email id/password is wrong, then it throws javax.mail.AuthenticationFailedException, and after that even though the mail id/password is correct, then also same exception thrown
Any suggestion ???
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Try not using the same connection for the second user ID.

(You should realize that I'm just making a guess here. If you want help which is not based on guesswork, then you should post the code which is having the problem.)
Sidhartha Ray
Greenhorn

Joined: Jul 04, 2012
Posts: 29
Thanks Paul !
That problem has been solved.

Previously I was using :

Session session = Session.getDefaultInstance(props, authenticator);

for creating session, but when I changed that to,

Session session = Session.getInstance(props, authenticator);

that problem is solved..

But, I could not understand the reason for that. Any suggestion ???
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: mail sending failed using java mail api
 
Similar Threads
how to implement sending mail?
Getting To address
URL settings in Java Mail server
Sending mail in a network
Authenticating users using JavaMail Api