我正在尝试通过Oracle设置UTL_MAIL,以便向用户发送有关帐户停用的电子邮件。以下是我到目前为止所做的事情 -
Installed the package - @utlmail.sql & @prvtmail.plb
Set smtp parameter - ALTER SYSTEM SET smtp_out_server = 'smtp.mail.com' SCOPE = BOTH;
Completed ACL setup:-
exec DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('utl_mail.xml','Allow mail to be send','SCHEMA', TRUE, 'connect');
commit;
exec DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('utl_mail.xml','SCHEMA', TRUE, 'connect');
exec DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('utl_mail.xml','SCHEMA', TRUE, 'resolve');
exec DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('utl_mail.xml','*',25);
commit;
然后我创建了一个测试程序,看看这一切是否有效
CREATE OR REPLACE PROCEDURE deactivated_email IS
vsender VARCHAR2(30) := 'sender@sender.edu';
vrecip VARCHAR2(30) := 'recip@recip.edu';
vsubj VARCHAR2(50) := 'Enter the subject here';
vmesg VARCHAR2(4000) := 'Enter the body';
vmtype VARCHAR2(30) := 'text/plain; charset=us-ascii';
BEGIN
utl_mail.send(
vsender,
vrecip,
NULL,
NULL,
vsubj,
vmesg,
vmtype,
NULL
);
END;
执行proc
EXECUTE deactivated_email;
收到错误
BEGIN deactivated_email; END;
Error report -
ORA-29279: SMTP permanent error: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [smtp.mail.com]
ORA-06512: at "SYS.UTL_MAIL", line 662
ORA-06512: at "SYS.UTL_MAIL", line 679
ORA-06512: at "DEACTIVATED_EMAIL", line 17
ORA-06512: at line 1
29279. 00000 - "SMTP permanent error: %s"
*Cause: A SMTP permanent error occurred.
*Action: Correct the error and retry the SMTP operation.
我让我们的交换团队为我正在处理的VM打开了超过25的smtp,我可以通过RHEL主机做一个sendmail,所以盒子是打开的。我猜测smtp需要从utl_mail包/ oracle进行某种身份验证,但到目前为止我还无法弄清楚我可以通过包/ oracle传递此身份验证的位置
感谢任何反馈
答案 0 :(得分:0)
即使虚拟机已为25个匿名用户打开,我仍然使用所需的身份验证的SMTP主机。提供了一个不同的SMTP主机别名,它现在可以正常工作。