This content has been marked as final. Show 8 replies
Is there a counterpart of this for 4.0 or later?The email package is now called APEX_MAIL. Here is the documentation for it:
The mechanics for using APEX_MAIL (including adding attachments) are demonstrated in the link provided (i.e. where it said "See Also: "APEX_MAIL" in Oracle Application Express API Reference). Specifically, that URL is:
Collect whatever you want to send in the email into a variable and then pass that variable to to appropriate APEX_MAIL procedure. The above link has example code.
I tried testing mail using this sample code at command line:
Why can not i test it on sqlplus? I want to send mail thru DBMS_scheduler and not in apex page.
SQL> DECLARE 2 l_body CLOB; 3 BEGIN 4 l_body := 'Thank you for your interest in the APEX_MAIL 5 package.'||utl_tcp.crlf||utl_tcp.crlf; 6 l_body := l_body ||' Sincerely,'||utl_tcp.crlf; 7 l_body := l_body ||' The APEX Dev Team'||utl_tcp.crlf; 8 apex_mail.send( 9 p_to => 'email@example.com', -- change to your email address 10 p_from => 'firstname.lastname@example.org', -- change to a real senders email address 11 p_body => l_body, 12 p_subj => 'Test EMAIL from APEX'); 13 END; 14 / DECLARE * ERROR at line 1: ORA-20001: This procedure must be invoked from within an application session. ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 290 ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 325 ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 367 ORA-06512: at line 8 SQL> begin 2 APEX_MAIL.PUSH_QUEUE; 3 end; 4 / PL/SQL procedure successfully completed.
See the link given below, helps you how to schedule a job.
KinsaKaUy? wrote:It helps if you read the documentation. It helps more if you read the documentation for the current version rather than searching out obscure references from 8 versions ago.
I read that already. My question is the above wont run on command line, so it will not also run when set on schedule. :(
The need to set the security group ID when calling <tt>apex_mail</tt> outside an APEX session is noted on the first page of the mail API docs.