This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply 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: 22
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: 16483
    
    2

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: 22
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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: mail sending failed using java mail api
 
Similar Threads
how to implement sending mail?
URL settings in Java Mail server
Getting To address
Sending mail in a network
Authenticating users using JavaMail Api