Configuring UTL_MAIL Package Prerequisites

旧街凉风 提交于 2019-12-12 01:19:28

问题


I was trying to configure my system to send mail using UTL_MAIL package but no luck .. I read that I need to configure ACL first. hence I did. But even doing so it's not working still.

SELECT * FROM dba_network_acls;

begin
  dbms_network_acl_admin.create_acl (
    acl         => 'utl_http.xml',
    description => 'HTTP Access',
    principal   => 'HR',
    is_grant    => TRUE,
    privilege   => 'connect',
    start_date  => null,
    end_date    => null
  );
  dbms_network_acl_admin.add_privilege (
    acl        => 'utl_http.xml',
    principal  => 'HR',
    is_grant   => TRUE,
    privilege  => 'resolve',
    start_date => null,
    end_date   => null
  );
  dbms_network_acl_admin.assign_acl (
    acl        => 'utl_http.xml',
    host       => 'smtp.gmail.com',
    lower_port => 25,  --- Gmail SMTP server.
    upper_port => 25
  );
  commit;
end;
/

I am getting error

ORA-29279: SMTP permanent error: 530 5.7.0 Must issue a STARTTLS command first. ei4sm3659171pbb.42 - gsmtp ORA-06512: at "SYS.UTL_MAIL", line 654 ORA-06512: at "SYS.UTL_MAIL", line 671 ORA-06512: at line 2 29279. 00000 - "SMTP permanent error: %s" *Cause: A SMTP permanent error occurred. *Action: Correct the error and retry the SMTP operation.

I have already executed the following commands

CONN sys/password AS SYSDBA

@$ORACLE_HOME/rdbms/admin/utlmail.sql

@$ORACLE_HOME/rdbms/admin/prvtmail.plb

Please help !


回答1:


Your SMTP server appears to require an encrypted connection. UTL_MAIL is designed to simplify the API for sending mail for basic SMTP servers. It doesn't support the full set of options defined by the SMTP protocol. I don't believe it supports TLS.

Assuming that you're using 11.2, you'll need to use the UTL_SMTP package and you'll need to call the STARTTLS function while you're setting up the connection.



来源:https://stackoverflow.com/questions/23763930/configuring-utl-mail-package-prerequisites

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!