|
|
|
Re: Restrict email recipients [message #683967 is a reply to message #683964] |
Wed, 10 March 2021 14:04 |
John Watson
Messages: 8960 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
jtaylor75 wrote on Wed, 10 March 2021 17:45Hello,
I'm trying to find a way to restrict Oracle to only allow email recipients in one or two specific domains. I have far too many users to build a white list of all email addresses, I'm hoping to be able to restrict by domain: e.g only send to recipients with @example.com addresses?
Running Oracle Database Standard 12.1.0.2 on RHEL 7. I have configured sendmail on the OS to only allow specific domains and that is working for anything sent through the OS, but just had an email sent directly from the database and it was not blocked by the sendmail config.
Oracle sends emails to an SMTP server, such as your sendmail. So it CANNOT send mail to somewhere that sendmail does not permit. You must have configured Oracle to send email to a different SMTP server, one that does not have the same restrictions.
|
|
|
Re: Restrict email recipients [message #683968 is a reply to message #683966] |
Wed, 10 March 2021 14:28 |
|
Michel Cadot
Messages: 68716 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
jtaylor75 wrote on Wed, 10 March 2021 20:41Can you expand on that at all? Apologies, I am the infrastructure administrator, I deal mostly with the server, Oracle installation, patching, and general config. I don't deal with creating stored procs or much at all inside the database. I ran your reply by my database developer and he isn't sure how that would work either.
The standard way to send email from Oracle is to call UTL_MAIL package.
Instead of this you can revoke all privileges on this package from everyone but a single account which will create a procedure with same parameters than UTL_MAIL.SEND (for instance) and then grant EXECUTE privilege to other accounts on this procedure.
So instead of calling:
UTL_MAIL.SEND (sender=>..., recipients=>..., subject=>..., message=>...);
you will call
My_Send (sender=>..., recipients=>..., subject=>..., message=>...);
procedure which will be defined as (simplified example):
CREATE OR REPLACE PROCEDRE My_Send (
SENDER VARCHAR2,
RECIPIENTS VARCHAR2,
SUBJECT VARCHAR2,
MESSAGE VARCHAR2)
IS
BEGIN
<code to check RECIPIENTS and raise an exception if not correct>
UTL_MAIL.SEND (sender=>sender, recipients=>recipients, subject=>subject, message=>message);
END;
/
|
|
|
Re: Restrict email recipients [message #683969 is a reply to message #683968] |
Wed, 10 March 2021 18:12 |
|
jtaylor75
Messages: 3 Registered: March 2021
|
Junior Member |
|
|
Thank guys, this is all above my Sys Admin level. I will refer your comments to my Oracle developer. I was hoping for a simple config option. Wishful thinking with Oracle I know...
|
|
|