Difference between revisions of "Email Notification Configuration"
Jump to navigation
Jump to search
Bilal.saeed (talk | contribs) |
|||
Line 1: | Line 1: | ||
Connect Sys user with SYSDBA rights and execute following | Connect Sys user with SYSDBA rights and execute following | ||
<pre> | <pre> | ||
− | GRANT EXECUTE ON UTL_HTTP to | + | GRANT EXECUTE ON UTL_HTTP to &db_user; |
− | GRANT EXECUTE ON UTL_TCP to | + | GRANT EXECUTE ON UTL_TCP to &db_user; |
− | GRANT EXECUTE ON UTL_SMTP to | + | GRANT EXECUTE ON UTL_SMTP to &db_user; |
− | GRANT EXECUTE ON UTL_INADDR to | + | GRANT EXECUTE ON UTL_INADDR to &db_user; |
</pre> | </pre> | ||
Line 13: | Line 13: | ||
acl => 'SendEmailService.xml', | acl => 'SendEmailService.xml', | ||
description => 'Send Email via Webservice', | description => 'Send Email via Webservice', | ||
− | principal => ' | + | principal => '&db_user', |
is_grant => TRUE, | is_grant => TRUE, | ||
privilege => 'connect' | privilege => 'connect' | ||
Line 24: | Line 24: | ||
dbms_network_acl_admin.add_privilege ( | dbms_network_acl_admin.add_privilege ( | ||
acl => 'SendEmailService.xml', | acl => 'SendEmailService.xml', | ||
− | principal => ' | + | principal => '&db_user', |
is_grant => TRUE, | is_grant => TRUE, | ||
privilege => 'resolve' | privilege => 'resolve' | ||
Line 35: | Line 35: | ||
dbms_network_acl_admin.assign_acl( | dbms_network_acl_admin.assign_acl( | ||
acl => 'SendEmailService.xml', | acl => 'SendEmailService.xml', | ||
− | host => ' | + | host => '&webservice' |
); | ); | ||
commit; | commit; | ||
Line 44: | Line 44: | ||
Test it using below; | Test it using below; | ||
<pre> | <pre> | ||
− | + | BEGIN | |
− | + | SET_SEND_EMAIL_PKG.SEND_EMAIL('Your Email Address', | |
− | + | NULL, | |
− | + | GET_SYS_DEFAULT('EMAIL_SERVER_IP'), | |
− | + | GET_SYS_DEFAULT('EMAIL_SERVER_PORT'), | |
− | + | GET_SYS_DEFAULT('EMAIL_FROM'), | |
− | + | 'Test Subject', | |
− | + | 'Test Message', | |
− | + | NULL, | |
+ | NULL, | ||
+ | NULL); | ||
+ | END; | ||
</pre> | </pre> | ||
Line 59: | Line 62: | ||
<pre> | <pre> | ||
SELECT * FROM dba_network_acl_privileges; | SELECT * FROM dba_network_acl_privileges; | ||
− | SELECT * FROM dba_network_acls; | + | SELECT * FROM dba_network_acls; |
+ | SELECT * FROM user_network_acl_privileges ; | ||
</pre> | </pre> | ||
Revision as of 04:39, 19 January 2018
Connect Sys user with SYSDBA rights and execute following
GRANT EXECUTE ON UTL_HTTP to &db_user; GRANT EXECUTE ON UTL_TCP to &db_user; GRANT EXECUTE ON UTL_SMTP to &db_user; GRANT EXECUTE ON UTL_INADDR to &db_user;
Connect System user and execute following
begin dbms_network_acl_admin.create_acl ( acl => 'SendEmailService.xml', description => 'Send Email via Webservice', principal => '&db_user', is_grant => TRUE, privilege => 'connect' ); commit; end; / begin dbms_network_acl_admin.add_privilege ( acl => 'SendEmailService.xml', principal => '&db_user', is_grant => TRUE, privilege => 'resolve' ); commit; end; / begin dbms_network_acl_admin.assign_acl( acl => 'SendEmailService.xml', host => '&webservice' ); commit; end; /
Test it using below;
BEGIN SET_SEND_EMAIL_PKG.SEND_EMAIL('Your Email Address', NULL, GET_SYS_DEFAULT('EMAIL_SERVER_IP'), GET_SYS_DEFAULT('EMAIL_SERVER_PORT'), GET_SYS_DEFAULT('EMAIL_FROM'), 'Test Subject', 'Test Message', NULL, NULL, NULL); END;
To verify the above script is successfully executed;
SELECT * FROM dba_network_acl_privileges; SELECT * FROM dba_network_acls; SELECT * FROM user_network_acl_privileges ;
Note:
- Where “host” is the IP of the Email Server (‘*’ means auto find the specific email server)
- Where “principal” is the Schema / Database Username where import the database