You can send an e-mail from an Oracle HTML DB 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:
See Also: "Configuring Oracle HTML DB to Send Mail" and "Managing E-mail" for information about viewing the mail queue and the mail log |
Oracle HTML DB stores unsent e-mail messages in a table named HTMLDB_MAIL_QUEUE
. A DBMS_JOB
background process is automatically created when you install Oracle HTML DB. This background process pushes the mail queue every 15 minutes. The package that is executed by the background process has two parameters:
p_smtp_host
is the hostname of your SMTP gateway. The default value is localhost
.
p_smtp_portno
is the port number of your SMTP gatway. The default value is 25
.
The most efficient approach to sending e-mail 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 send an e-mail from an Oracle HTML DB 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 theUTL_SMTP package
|
HTMLDB_MAIL
contains two procedures for manually sending e-mail:
Use the HTMLDB_MAIL.SEND
procedure to manually send an outbound e-mail message from your application
Use HTMLDB_MAIL.PUSH_QUEUE
to deliver mail messages stored in HTMLDB_MAIL_QUEUE
Oracle HTML DB stores unsent e-mail 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
. This procedure requires two input parameters:
p_smtp_hostname
defines the host name of your SMTP gateway
p_smtp_portno
defines port number of your SMTP gateway (for example, 25)
Oracle HTML DB 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. In this example, the SMTP gateway host name is defined as smtp01.oracle.com
and the SMTP gateway port number is 25
.
SQLPLUS / <<EOF FLOWS_020000.HTMLDB_MAIL.PUSH_QUEUE('smtp01.oracle.com','25'); DISCONNECT EXIT EOF