Previous |
Next |
You can use the APEX_MAIL
package to send an email from an Oracle Application Express application. This package is built on top of the Oracle supplied UTL_SMTP
package. Because of this dependence, the UTL_SMTP
package must be installed and functioning in order to use APEX_MAIL.
See Also: Oracle Database PL/SQL Packages and Types Reference for more information about the UTL_SMTP package |
APEX_MAIL
contains three procedures. Use APEX_MAIL.SEND
to send an outbound email message from your application. Use APEX_MAIL.PUSH_QUEUE
to deliver mail messages stored in APEX_MAIL_QUEUE
. Use APEX_MAIL.ADD_ATTACHMENT
to send an outbound email message from your application as an attachment.
Note: The most efficient approach to sending email is to create a background job (using the DBMS_JOB or DBMS_SCHEDULER package) to periodically send all mail messages stored in the active mail queue. In order to call the APEX_MAIL package from outside the context of an Application Express application, you must callapex_util.set_security_group_id as in the following example:
for c1 in ( select workspace_id from apex_applications where application_id = p_app_id ) loop apex_util.set_security_group_id(p_security_group_id => c1.workspace_id); end loop; |