../E11947-03.epub /> ../E11947-03.mobi />
This section describes how to send email from an Oracle Application Express application.
Topics in this section include:
See Also:"Managing Mail" in Oracle Application Express Administration Guide
Tip:If you are running Oracle Application Express with Oracle Database 11g Release 1 (11.1), you must enable network services in order to send outbound email. See "Enabling Network Services in Oracle Database 11g"
Before you can send email from an Application Builder application, you must:
Log in to Oracle Application Express Administration Services and configure the email settings on the Instance Settings page. See in Oracle Application Express Administration Guide.
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".
Tip:You can configure Oracle Application Express to automatically email users their login credentials when a new workspace request has been approved. To learn more, see "Specifying a Provisioning Mode"in Oracle Application Express Administration Guide.
You can send an email from an Application Builder application by calling the PL/SQL package
APEX_MAIL. This package is built on top of the Oracle supplied
UTL_SMTP package. Because of this dependence, in order to use
UTL_SMTP package must be installed and functioning.
See Also:Oracle Database PL/SQL Packages and Types Reference for more information about the UTL_SMTP package and "APEX_MAIL" in Oracle Application Express API Reference
APEX_MAIL contains three procedures for sending email:
APEX_MAIL.SEND to manually send an outbound email mess age from your application
APEX_MAIL.ADD_ATTACHMENT to send an outbound email message from an application as an attachment. APEX_MAIL.ADD_ATTACHMENT
APEX_MAIL.PUSH_QUEUE to deliver mail messages stored in
Oracle Application Express stores unsent email messages in a table named
APEX_MAIL_QUEUE. You can deliver mail messages stored in this queue to the specified SMTP gateway by calling the procedure
Oracle Application Express logs successfully submitted messages in the table
APEX_MAIL_LOG with the timestamp reflecting your server's local time.
The following UNIX/LINUX example demonstrates the use of the
APEX_MAIL.PUSH_QUEUE procedure using a shell script.
SQLPLUS / <<EOF APEX_MAIL.PUSH_QUEUE; DISCONNECT EXIT EOF