UTL_MAIL strongly rely on TCP (Network) and the number of active TCP connections that can be open for a session is 16, per documented Bug 8262564. Bug 8262564 got fixed in Oracle 11g 184.108.40.206 or later and also on Oracle 11g 220.127.116.11 as one-off patches. Bug 8262564 is quoted as reference to state that the number of active TCP connections that can be open for a session is 16. While UTL_MAIL does not have restrictions but the TCP that serves as the base for Mail related packages such as UTL_MAIL and UTL_SMTP does have an active session limit of 16.
You say: "the number of UTL_SMTP connections being made and closed". Are you sure about the closing part? When you open a mail connection, you have to explicitly close it:
-- open smtp connection
my_conn := utl_smtp.open_connection(
host => 'www.testlink.com',
port => 25);
-- Explicitly close the connection oppened
utl_smtp.quit(c => my_conn);
when others then
raise_application_error (-20002,'An error has occurred.');
Please, note that If UTL_MAIL throws an exception and emails are resend from the exception, the smtp connections are lift open and after 15 successive exceptions UTL_MAIL throws errors.
Connection is getting closed only in those cases when UTL_MAIL.SEND succeeds without any error. Since everything related to a connection is done within the UTL_MAIL package it is not possible to close the connection from outside the package.
I do not know a v$ to count open smpt/tcp connections for an Oracle session.
I think you can do it by yourself, for example using the following code:
set serveroutput on
alter session set smtp_out_server='<smtp_server_name:25>';
cnt number := 1;
for i in 1..20 loop
UTL_MAIL.send('email@example.com','firstname.lastname@example.org',NULL,NULL,'testing invalid email','testing invalid email' );
When Others then
UTL_MAIL.send('email@example.com','firstname.lastname@example.org',NULL,NULL,'send from exp block','send from exp block');
cnt := cnt + 1;
I found this code on Oracle Metalink knowledge base. After each error, you increase a counter to monitor the number of open connections.