6 Replies Latest reply: Apr 28, 2014 12:06 AM by Luis Cabral RSS

    Function apex_mail.send failing in test environment

    Luis Cabral

      Hi there,

       

      Oracle 11.2.0.3.0

      Apex 4.2.1.00.08

       

      I am using the following call to send email from a dbms_scheduler job (i.e. without a valid Apex session):

       

        wwv_flow_api.set_security_group_id(NULL);

       

       

        v_id := apex_mail.send(p_to        => v_email_to

                              ,p_from      => p_from

                              ,p_body      => v_email_body

                              ,p_body_html => v_email_body_html

                              ,p_subj      => v_subject

                              ,p_cc        => v_email_cc

                              ,p_bcc       => v_email_bcc);

       

       

      This works fine in our development environment, but in our test environment it raises this error:

       

      ORA-20001: This procedure must be invoked from within an application session.

      ORA-06512: at "XXXX", line 4072

      ORA-06512: at "XXXX", line 4111

      ORA-06512: at line 1

       

      The only difference I can think of is that we have the full Apex Builder in the development environment but only the Apex run-time in the test one.

       

      Any ideas about what could be causing this behavior? Maybe some instance-level setting in Apex? If this was to fail, I'd expect it to fail in both environments.

       

      Thanks

      Luis