Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Send mail through Apex from database procedure

PamNLDec 13 2016 — edited Dec 14 2016

Ok, so I know you have to set the security group id to be able to send emails using the apex mailer outside Apex

l_workspace_id := apex_util.find_security_group_id ('MYWORKSPACE');

apex_util.set_security_group_id (l_workspace_id);

to avoid getting errors like 'This procedure must be invoked from within an application session'.

But I'm running this procedure under a different database user then the Apex user. So my workspace id is null if I call the find security group id.

My database user is APPS (calling it from eBusiness Suite) and the Apex user is some custom user like XXX_APEX. He owns the workspace. APPS can execute the function, but cannot see any records in APEX_APPLICATIONS for example.

Is there a way around this so I can invoke these functions under APPS user rather than my custom user (since I may not be able to switch to the custom user when running procedures from Apps)?

Reason I want to do this is that we send emails from Apex front-end. However, if the number of emails is too high we like to schedule this for the background. But then suddenly I cannot use the Apex_Mail.Send procedure and have to use UTL_MAIL, which gives me other issues unfortunately due to the SMTP Host Address used.

This post has been answered by PamNL on Dec 14 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2017
Added on Dec 13 2016
5 comments
730 views