aspose 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
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: 18570
    
    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 ???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mail sending failed using java mail api