问题描述
必须使用APEX_MAIL.SEND()
方法从 oracle apex
发送电子邮件.
Have to send email from oracle apex
using APEX_MAIL.SEND()
method.
我正在使用代码:
BEGIN
apex_mail.send(p_to => '[email protected]'/*l_to_addr*/,
p_from => '[email protected]'/*l_from_addr*/,
p_bcc => l_bcc_addr,
p_subj => l_mail_sub,
p_body => 'Service Request ' || :mail_body ||
'Note:- This is a system generated Email. Please DO NOT REPLY to it.');
apex_mail.push_queue;
EXCEPTION
when others then
INSERT INTO send_mail_error_test VALUES ('Send_mail',systimestamp,:service_request_id||'-err:'||seq_service_req_error_id.NEXTVAL);
COMMIT;
END;
***所有变量均包含正确的值
*** all the variables contain correct values
-
使用数据库并且该数据库具有ACL(访问控制列表)访问权限
Working with a database and that database has ACL(access control list) access
在apex管理服务中,启用了将电子邮件配置为主机名,端口,电子邮件配置的实例设置.
In apex administrative services, Configured instance settings for email as hostname, port , email provisioning enabled.
已安装UTL_SMTP软件包
UTL_SMTP package is installed
在相同的过程中,在相同的控制流处,尽管apex_mail.send()无法正常工作,但是使用utl_Smtp发送邮件的代码仍然可以正常工作.
From the same process, at the same point of control flow a code to send mail using utl_Smtp is working fine, though that apex_mail.send() is not working.
该apex_mail.send()
没有给出任何错误或异常,但我没有收到它的电子邮件.
That apex_mail.send()
is not giving any error or exception, but i am not recieving email from it.
有些困惑,得到了一些类似的解决方案,应该在ACL
中添加'APEX_040200
'.但是我正在使用并在其上实现代码的数据库,比如说apex_user
已经添加到了ACL
中.即使现在我是否必须在ACL
上添加'APEX_040200
'或'APEX_050200
'?
Have one confusion, got some solutions like that, 'APEX_040200
' should have been added to ACL
. But the database I am using and implementing the code on it, say 'apex_user
' is already added to ACL
. Even now do I have to add 'APEX_040200
' or 'APEX_050200
' to ACL
?
有人可以帮助我,给我一个富有成果的解决方案吗?我正在使用apex 5.0.2.00.07.
can anyone help me out and give me a fruitful solution? I am using apex 5.0.2.00.07.
推荐答案
可以在 apex_mail api文档:
-
登录到Oracle Application Express管理服务,然后 在实例设置"页面上配置电子邮件设置.看 《 Oracle Application Express管理指南》中的配置电子邮件".
Log in to Oracle Application Express Administration Services and configure the email settings on the Instance Settings page. See "Configuring Email" in Oracle Application Express Administration Guide.
如果将Oracle Application Express与Oracle Database 11g一起运行 在发行版1(11.1)中,必须启用出站邮件.在Oracle数据库中 在11g第1版(11.1)中,与网络服务进行交互的能力是 默认禁用.请参阅在Oracle数据库中启用网络服务 《 Oracle Application Express应用程序构建器用户指南》中的"11g".
If you are running Oracle Application Express with Oracle Database 11g release 1 (11.1), you must enable outbound mail. In Oracle Database 11g release 1 (11.1), the ability to interact with network services is disabled by default. See "Enabling Network Services in Oracle Database 11g" in Oracle Application Express Application Builder User's Guide.
您指定的实例设置没问题.您的数据库具有ALC访问权限"没有任何意义.您是说您有一个使用网络ACL的数据库? (11克或更高)相同的文档链接到在Oracle数据库中启用网络服务11g或更高版本"文档
You specified instance settings are ok. Your "database has ALC access" doesn't mean anything. Do you mean you have a database which uses network ACLs? (11g or higher)That same documentation links to "the Enabling Network Services in Oracle Database 11g or Later" documentation
此文档不会让您猜测:
如果您有apex的旧版本,例如4.2,则要授予的用户是另一个,可以在文档中找到.或者,您可以找出例如,通过查询ALL_USERS
视图并找到APEX_######
用户,选择具有最高版本号的用户:
If you have an older version of apex, eg 4.2, the user to grant to is another one, and can be found in the documentation. Alternatively, you can just find outby for example querying the ALL_USERS
view and find the APEX_######
users, pick the one with the highest version number:
select *
from all_users
where username like 'APEX%'
order by username;
这篇关于APEX_MAIL.SEND函数无法正常运行,但未给出任何错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!