Mail::send() doesn't close smtp connection

[email protected] (Stepan Vorobyov) Thu, 22 Jan 2015 20:24:13 +0300
Newsgroups php.pear.general
Message-ID <[email protected]>
I repeat this message because the previous one had 
Content-Transfer-Encoding: base64 and was not displayed properly in web 
interface http://news.php.net/php.pear.general/31973

Hello!

I use Mail::send() with smtp backend to send mails from php script on my 
FreeBSD server.
It works fine when everyting is ok.
But if there's an error (E.g. SMTP authentication failure) Mail::send() 
finishes with error and leaves tcp connection with smtp server open.

Is this a feature or bug?

My script tried to send thousands of mails and thus hit the system limit 
of open files (network connection is concidered as an open file). As a 
result other services (such as database) became unavailable too.

So... Is it the right behavior for Mail::send() not to close the connection?

Thanks.