This content has been marked as final. Show 2 replies
I'm not completely clear on what it is you're doing...
You can definitely share a JavaMail Session object between threads since the Session contains
only configuration information.
Sharing a JavaMail Transport object between threads is not a good idea. A Transport represents
a connection to the mail server and only one thread can use the connection at a time.
If you open a Transport connection and keep it around for a long time without using it, the server
may close the connection. Servers want you to open connections only when you're using them.
Servers also don't want you to abuse a connection and so may close a connection if they think
you're using it too much (e.g., to send spam). You can't prevent either of these actions, but you
can detect that the connection has been closed and open a new connection when you need it.