Oracle Tips by Burleson
Creating a Form for Email
Not only will this section show a simple form for
emailing, but it will also introduce the HTMLDB_MAIL package. The HTMLDB_MAIL package is used by the
developer to send email from within HTML DB.
For information on setting up Email, refer to
Chapter 15 – HTML DB Administration II.
In the following example, it will be necessary to
build a new page with page ID 1080. The page created by the author is
shown in Figure 8.19 and is included in the EASY Sample application in
the code depot. Building pages, buttons, and page items have already
been introduced, so those steps will not be repeated here. Since many
text messages are limited to maximum length, the text area was limited
to 160 characters.
The data in the select list is populated from a
table named EASY_PERSON. The table contains a column with an email
address that can be used to send text messages to a person’s cell
To send the text message, an After Submit page
process will be created that executes on the condition when the Send
Message button is pressed. The code used for the email process is
shown in file ch8_1.sql contained in the code depot.
The HTMLDB_MAIL.SEND procedure can send text of
data type VARCHAR2 or CLOB; however, the limit for the length of any
single line is 1000 characters. After the 1000 character limit, a new
line must be included before continuing the email message.
The person’s pager address is being selected and
used in the p_to parameter of the send procedure. The message body is
taken from the P1080_MSGTEXT page item.
Also, take notice of the use of
htmldb_mail.push_queue procedure. Email in HTML DB is placed
into a message queue and processed every ten minutes. However, since
text messages can sometimes be urgent, such as a production database
issue, the htmldb_mail_push_queue procedure has been used to force the email queue to send
all messages immediately.
where id = :P1080_ID;
p_to => s_pager,
p_body => :P1080_TEXTMSG,
p_subj => 'HTML DB Email' );
htmldb_mail.push_queue( 'localhost', 25 );
The above book excerpt is from:
Oracle Application Express
Dynamic Web Pages with OAE
Michael Cunningham & Kent Crotty