Oracle APEX send a message

1. Network Service security settings

Oracle 11gR2 version may cause the message failed to send (ORA-24247: network access denied by access control list (ACL)) or e-mail is not sent. 11g uses a more stringent Web services security control ACLs (Access Control Lists), you can use sysdba user login, execute the following code:

begin
dbms_network_acl_admin.create_acl (
   acl          => 'networkacl.xml',
   description  => 'Allow Network Connectivity',
   principal    => 'PUBLIC',
   is_grant     => TRUE,
   privilege    => 'connect',
   start_date   => SYSTIMESTAMP,
   end_date     => NULL);
 
dbms_network_acl_admin.assign_acl (
   acl         => 'networkacl.xml',
   host        => '*',
   lower_port  => NULL,
   upper_port  => NULL);
 
commit;
end;

 

Also refer to the following address Bowen: https://blog.csdn.net/apextrace/article/details/8518022

2. Configure Apex mail management

 

3. Execute the following code to send mail

DECLARE
    l_body      CLOB;
BEGIN
    l_body := '邮件内容 Hello Apex';
    apex_mail.send(
        p_to       => '[email protected]',   --收件者
        p_from     => '[email protected]', -- 发送者
        p_body     => l_body,
        p_subj     => '邮件主题 hello');

END;

 完

 

 

提示:如果你以上步骤都设置无误,但还是发不出去,有可能设置的其他项影响的。

用 sys 账号执行下列代码

SELECT * FROM dba_network_acls;  

如果查询出多行,请把其他多的删除,删除代码如下:

--删除多余的
BEGIN
 DBMS_NETWORK_ACL_ADMIN.drop_acl(acl => 'network_services.xml');
 COMMIT;
END;
 

 

network_services.xml 对应 ACL 列,杠(/)后的内容。

如果删除自己在步骤1添加的内容,请执行下列代码:

BEGIN
DBMS_NETWORK_ACL_ADMIN.drop_acl(acl => 'networkacl.xml');
COMMIT;
END;

 

再次提示:如果还是不能发送,请检查防火墙配置

   

Guess you like

Origin www.cnblogs.com/ser0632/p/11390209.html