I am using java mail for sending emails. As the service is multithreaded every thread is creating a new connection to the email server. Is there a way to create an SMTP connection pool so every thread will use the same connection for sending emails?
One thing I have tried is- I am storing the Session transport object in hashmap so I can use that transport object in each thread. I am not sure if it is the correct way or not.