How to connect smtp port 25 in second time?
I am using Apache commons mail to send mail in my web application. My web application is hosted in Tomcat. When I try to send mail for the first time after server starts. I am able to send mail. But after that, when I attempted second time, it is not connecting to SMTP port 25
.
By using setDebug(true);
, I could able to find that after emailObj.send()
, it closes the connection. So then it couldn't connect next ti开发者_C百科me.
How to resolve my issue?
Are you reusing the same Email instance ?
Email is a class representing one Email, which you will sent through send() method.
If you want to send another email, you have to instantiate a new Email object.
精彩评论