Thank you very much
A reader, August 05, 2009 - 4:18 pm UTC
Tom Thanks a lot.
Not able to receive email though set_security_group_id
Amarnath, May 28, 2018 - 7:27 am UTC
Ran below code from custom schema which is created for APEX.
Program ran successfully with output messages displayed(BEGIN,END) , but didn't received mail.
Where as ran same script(with different subject) from APEX application and received mail.
begin
dbms_output.put_line('BEGIN');
wwv_flow_api.set_security_group_id(1817032601053388);
APEX_MAIL.SEND(
p_to => 'xxxx.xxxxxx@gmail.com',
p_from => 'dev.oracle.ebs.noreply@ncp.co.uk',
p_subj => 'Subject (from Pl/Sql)',
p_body => 'Please review the Requests.',
p_body_html => '
Please review the Requests. http://XXXXXXXXXX:XXXX/ords/f?p=105:4:::::: ');
dbms_output.put_line('END');
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error:'||substr(sqlerrm,1,300));
end;
Not able to receive email though set_security_group_id
Amarnath, May 28, 2018 - 10:48 am UTC
used set_Security_group_id before APEX_MAIL.SEND like
wwv_flow_api.set_security_group_id(worspace_id);
I received mail 2 hours later of code run(anonymous block).
But whereas when I run the same anonymous block by logging into APEX application, I received the mail immediately.
May 29, 2018 - 1:55 am UTC
Add the following at the end of your call
apex_mail.push_queue();
Scheduled Job created based on package with APEX_MAIL.send failing to send mail
Amarnath, May 29, 2018 - 10:27 am UTC
Hi,
Created a scheduled job based on pl/sql package for every 10 minutes which sends mail using APEX_MAIL.send
Added wwv_flow_api.set_security_group_id(vWorkspaceId)
before calling APEX_MAIL.send and
Added apex_mail.push_queue() after APEX_MAIL.send
The Scheduled job is failing with exception:
ORA-20001: This procedure must be invoked from within an application session.
But when I run the job as Anonymous block from backend, I received mail successfully.
BEGIN
dbms_output.put_line('Start');
dbms_scheduler.run_job('XXX_JOB_REC_SEND_EMAIL',TRUE);
dbms_output.put_line('End');
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Exception:'||substr(sqlerrm,1,300));
END;
Regards
Amar
May 30, 2018 - 6:08 am UTC
You should already have a scheduled job (that was created by Apex):
ORACLE_APEX_MAIL_QUEUE
so I'm not sure why are adding more.
You need to give us a top-to-bottom example, not snippets of code here and there
Scheduled Job created based on package with APEX_MAIL.send failing to send mail
Amarnath, May 29, 2018 - 10:47 am UTC
The scheduled job and package were created under custom schema That custom schema is created for APEX application.
I run the job using anonymous block in custom schema.