i have done all the activity i.e mention below, please tell which step / activity i am missing.
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(
You don't need any commit
, since explicit DML operations are not performed for these operations. And using begin..end
blocks not needed for every method invoking, either.
Your issue stems from the fact the neccessity of invoking Dbms_Network_Acl_Admin.Add_Privilege
method with privilege => 'connect'
option also. So you can use the following :
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(
acl => 'apex_user.xml',
description => 'access to apex email',
principal => 'DBUSER',
is_grant => TRUE,
privilege => 'connect',
start_date => SYSTIMESTAMP,
end_date =>Null
);
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
acl => 'apex_user.xml',
principal => 'DBUSER',
is_grant => true,
privilege => 'connect'
);
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
acl => 'apex_user.xml',
principal => 'DBUSER',
is_grant => true,
privilege => 'resolve'
);
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(
acl => 'apex_user.xml',
host => 'smtp.gmail.com',
lower_port =>587,
upper_port =>587
);
END;
With the following query all privileged accesses could be checked ( through SYS or SYSTEM schemas ):
select a.host,p.*
from dba_network_acl_privileges p
join dba_network_acls a on a.aclid = p.aclid
order by a.host, p.principal, p.privilege;
1) IMHO smtp.gmail.com requires secured connection and authentication but package utl_mail
is not supporting these functions. You can achieve this with utl_smtp.
2) The Apex_mail package run with the privileges of their definer (apex_scheama) and your acl list is defined for dbuser. Also here you have somehow do the smtp authentication .