- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们计划安装 UTL_MAIL
包,目前正在开发环境中测试安装步骤。
成功安装 UTL_MAIL
包脚本并创建足够的 PUBLIC
Synonyms 和 Grants 后,
运行下面的测试匿名块时,我们收到错误 ORA-29278
:
BEGIN
UTL_MAIL.SEND(sender => 'xxx@oracle.com'
, recipients => 'Migs.Isip.23@gmail.com'
, subject => 'Testmail'
, message => 'Hello');
END;
ORA-29278: SMTP transient error: 421 4.3.2 Service not available
ORA-06512: at "SYS.UTL_MAIL", line 662
ORA-06512: at "SYS.UTL_MAIL", line 679
ORA-06512: at line 3
29278. 00000 - "SMTP transient error: %s"
*Cause: A SMTP transient error occurred.
*Action: Correct the error and retry the SMTP operation.
DECLARE
-- ACL name to be used for email access reuse the same value for all
-- future calls
l_acl VARCHAR2 (30) := 'utl_smtp.xml';
-- Oracle user to be given permission to send email
l_principal VARCHAR2 (30) := 'APPS';
-- Name of email server
g_mailhost VARCHAR2 (60) := 'smtprelay.xxxxx.com';
l_cnt INTEGER;
PROCEDURE validate_smtp_server
AS
l_value v$parameter.VALUE%TYPE;
l_parameter v$parameter.name%TYPE := 'smtp_out_server';
BEGIN
SELECT VALUE
INTO l_value
FROM v$parameter
WHERE name = l_parameter;
IF l_value IS NULL
THEN
raise_application_error (
-20001
, 'Oracle parameter '
|| l_parameter
|| ' has not been set'
|| UTL_TCP.crlf
|| 'it s/b smtprelay.alorica.com'
);
END IF;
DBMS_OUTPUT.put_line ('parameter ' || l_parameter || ' value is ' || l_value);
END validate_smtp_server;
PROCEDURE create_if_needed (p_acl IN VARCHAR2)
AS
l_cnt INTEGER;
BEGIN
SELECT COUNT (*) c
INTO l_cnt
FROM dba_network_acls a
WHERE SUBSTR (acl, INSTR (acl, '/', -1) + 1) = p_acl;
IF l_cnt = 0
THEN
DBMS_OUTPUT.put_line ('creating acl ' || p_acl);
DBMS_NETWORK_ACL_ADMIN.create_acl (
acl => p_acl
, description => 'Allow use of utl_smtp'
, principal => l_principal
, is_grant => TRUE
, privilege => 'connect'
);
DBMS_NETWORK_ACL_ADMIN.assign_acl (acl => p_acl, HOST => g_mailhost);
COMMIT;
ELSE
DBMS_OUTPUT.put_line (p_acl || ' acl already exists');
END IF;
END create_if_needed;
PROCEDURE add_if_needed (
p_principal IN VARCHAR2
, p_acl IN VARCHAR2
)
AS
l_cnt INTEGER;
BEGIN
SELECT COUNT (*) c
INTO l_cnt
FROM dba_network_acl_privileges
WHERE SUBSTR (acl, INSTR (acl, '/', -1) + 1) = p_acl
AND principal = p_principal;
IF l_cnt = 0
THEN
DBMS_NETWORK_ACL_ADMIN.add_privilege (
acl => 'utl_smtp.xml'
, principal => p_principal
, is_grant => TRUE
, privilege => 'connect'
);
COMMIT;
DBMS_OUTPUT.put_line ('access to ' || p_acl || ' added for ' || p_principal);
ELSE
DBMS_OUTPUT.put_line (p_principal || ' already has access to ' || p_acl);
END IF;
END add_if_needed;
BEGIN
EXECUTE IMMEDIATE 'grant execute on utl_mail to ' || l_principal;
create_if_needed (p_acl => l_acl);
add_if_needed (p_principal => l_principal, p_acl => l_acl);
DBMS_OUTPUT.put_line ('Verification SQL:');
DBMS_OUTPUT.put_line (' SELECT * FROM dba_network_acls;');
DBMS_OUTPUT.put_line (' SELECT * FROM dba_network_acl_privileges;');
COMMIT;
validate_smtp_server;
END;
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Solaris: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
最佳答案
我能够通过联系我们的系统管理员并询问邮件服务器的详细信息来解决这个问题。
事实证明,如果我们只在内部发送电子邮件,我们建议使用不同的服务器 mail.xxx.xxx.xxxx
因为它不会被防火墙阻止。
另一方面,如果我们要向外部发送电子邮件,则涉及另一台服务器 smtprelay.xxxxx.com
这涉及将要发送到的外部服务器列入白名单的额外步骤。
当我登记时 V$PARAMETER
,我们使用的是 smtprelay.xxxxx.com
服务器并决定尝试另一台服务器 mail.xxx.xxx.xxxx
.
我发出了如下 Alter 命令:
alter system set smtp_out_server = 'mail.xxx.xxx.xxxx';
BEGIN
UTL_MAIL.SEND(sender => 'xxx@oracle.com'
, recipients => 'Migs.Isip.23@gmail.com'
, subject => 'Testmail'
, message => 'Hello');
END;
关于oracle - ORA-29278 : SMTP transient error: Service not available when running UTL_MAIL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41377078/
我在使用 Oracle 10g 中的 UTL_MAIL 包时遇到了一些问题,想知道是否有人有任何解决方案? 我以 SYSMAN 身份连接到我的数据库并加载以下两个脚本; @C:\oracle\prod
我有一个 pl/sql 程序,可以向许多人(20,000+)发送电子邮件。我的问题与 utl_mail 包有关,以及何时实际打开到电子邮件服务器的连接。 例子: BEGIN ... OPEN CUR_
我正在尝试使用 UTL_MAIL.Send 打包过程从 PL/SQL 程序发送电子邮件。但我收到以下错误: ORA-29278: SMTP transient error: 421 Service n
我们计划安装 UTL_MAIL 包,目前正在开发环境中测试安装步骤。 成功安装 UTL_MAIL 包脚本并创建足够的 PUBLIC Synonyms 和 Grants 后, 运行下面的测试匿名块时,我
我是一名优秀的程序员,十分优秀!