|
 |
|
Oracle Tips by Burleson |
APEX's HTMLDB_MAIL package
The ability to send email from APEX is provided
by the HTMLDB_MAIL package. This package uses the UTL_SMTP package in
Oracle.
send(
p_to in varchar2,
p_from in varchar2,
p_body in [ varchar2 | clob ],
p_body_html in [ varchar2 | clob ]
default null,
p_subj in varchar2 default null,
p_cc in varchar2 default null,
p_bcc in varchar2 default
null );
The send procedure is used to send email. The two
columns, p_body and p_body_html will accept either a data type of
varchar2 or clob. However, they must match each other. If a varchar2
is used in one, the other must be NULL or a varchar2. The same holds
true for a clob. They need to match or be NULL.
Example:
declare
s_pager easy_person.pager%type;
begin
select pager
into s_pager
from easy_person
where id = :P1080_ID;
htmldb_mail.send(
p_to => s_pager,
p_from =>
'easyhtmldb@rampant.cc',
p_body => :P1080_TEXTMSG, p_subj => 'Text
message from HTML DB' );
htmldb_mail.push_queue( 'localhost', 25 );
end;
htmldb_mail.push_queue(
p_smtp_hostname in varchar2
default,
p_smtp_portno in number default
);
When using the htmldb_mail.send procedure to send
emails, a mail queue is used. Mail is sent from the queue at ten
minute intervals. This procedure can be used to force the mail in the
queue to be sent immediately. An example of that is shown in the
example code for the htmldb_mail.send procedure.
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 |