APEX-AT-WORK no image

APEX_MAIL with UTL_TCP under XE database

Von Tobias Arnhold 9.24.2008
If you want to use the features of the UTL_TCP package you need to publish it to your APEX application user. (I tested it under APEX 3.1.2)

How to:

-- sqlplus
GRANT EXECUTE ON "SYS"."UTL_TCP" TO "APEX_USER"

-- sqlplus
create or replace synonym UTL_TCP for SYS.UTL_TCP;

-- an APEX process procedur
-- apex_mail procedure call
apex_mail.send(
p_to => 'user@company.com',
p_from => 'info@company.com',
p_body => 'New message cerated from ' || :p1_user || '.' || utl_tcp.crlf ||
'Description: ' || utl_tcp.crlf || :p1_description,
p_subj => 'New message! ' utl_tcp.crlf);

-- push the e-mail queue for immediate delivery
wwv_flow_mail.push_queue(
P_SMTP_HOSTNAME => 'ip',
P_SMTP_PORTNO => 'port');

Update (08.09.2009):
There was a interesting question about the APEX_MAIL function and pushing the email queue in the Oracle forum which you may be interested on: apex mail - mail queue

Post Tags: