Sending Email from an Application

Previous
Previous
 
Next
Next

You can send an email from an Application Builder application by:

Topics:

Sending Email Using a Background Job

Oracle Application Express stores unsent email messages in a table named APEX_MAIL_QUEUE. A DBMS_JOB background process is automatically created when you install Oracle Application Express. This background process pushes the mail queue every 15 minutes. By default, this job number is 4002 and is created in the Application Express schema (FLOWS_020200).

The most efficient approach to sending email is to create a background job (using a DBMS_JOB package) to periodically send all mail messages stored in the active mail queue.

Sending Email Manually by Calling APEX_MAIL

You can also send an email from an Oracle Application Express application by calling the PL/SQL APEX_MAIL package. This package is built on top of the Oracle supplied UTL_SMTP package. Because of this dependence, in order to use APEX_MAIL, the 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"

APEX_MAIL contains two procedures for manually sending email:

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 APEX_MAIL.PUSH_QUEUE.

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


See Also:

"APEX_MAIL" for information about using the APEX_MAIL