 |
|
Oracle Database Tips by Donald Burleson |
Creating
a Form for Email with APEX
Not only will this section show a simple form for
emailing, but it will also introduce the HTMLDB_MAILpackage. The HTMLDB_MAIL package is used by the developer
to send email from within APEX.
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
phone.
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 APEX 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.
The above book excerpt is from:
Easy HTML-DB
Oracle Application Express
Create
Dynamic Web Pages with OAE
ISBN 0-9761573-1-4
Michael Cunningham & Kent Crotty
http://www.rampant-books.com/book_2005_2_html_db.htm |