bbottema/simple-java-mail

Make sure Transport is closed after sending

zimmi opened this issue · 4 comments

zimmi commented

In Mailer::sendMail the Transport could be left open when an error occurs during sending.
It might be better to use a try-finally block like in this example in the official FAQs.

zimmi commented

Since JavaMail 1.5 there also seem to be new static Transport::send methods that do the proper cleanup for you. But that might break backward compatibility for users of this library with older JavaMail versions.

The simple-java-mail is mature enough by now that I don't see any critical bug fixes coming very soon for older versions, so I'm probably going to go ahead and use the newer mail API for the next simple-java-mail installment.

@zimmi

Released in v2.5.1.

Added a finally clause.

zimmi commented

It's java-simple-mail after all. Thanks! :)