Application Express User's Guide > Understanding Application A... > How to Send Email from an A... > Sending Email from an Appli...
Sending Email from an Application |
Previous |
Next |
You can send an email from an Application Builder application by:
Creating a background job to periodically send all mail messages stored in the active mail queue
Calling the PL/SQL package HTMLDB_MAIL
Topics:
Oracle Application Express stores unsent email messages in a table named HTMLDB_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.
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.
You can also send an email from an Oracle Application Express application by calling the PL/SQL HTMLDB_MAIL
package. This package is built on top of the Oracle supplied UTL_SMTP
package. Because of this dependence, in order to use HTMLDB_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 "HTMLDB_MAIL" |
HTMLDB_MAIL
contains two procedures for manually sending email:
Use the HTMLDB_MAIL.SEND
procedure to manually send an outbound email message from your application
Use HTMLDB_MAIL
to deliver mail messages stored in HTMLDB_MAIL_QUEUE
Oracle Application Express stores unsent email messages in a table named HTMLDB_MAIL_QUEUE
. You can deliver mail messages stored in this queue to the specified SMTP gateway by calling the procedure HTMLDB_MAIL.PUSH_QUEUE
.
Oracle Application Express logs successfully submitted messages in the table HTMLDB_MAIL_LOG
with the timestamp reflecting your server's local time.
The following UNIX/LINUX example demonstrates the use of the HTMLDB_MAIL.PUSH_QUEUE
procedure using a shell script.
SQLPLUS / <<EOF FLOWS_020100.HTMLDB_MAIL.PUSH_QUEUE; DISCONNECT EXIT EOF