You need the utl_mail package to send e-mail from the database. To use this package, the smtp_out_server parameter must be set.
Also, “network acl” should be created for the relevant user and the relevant privileges must be defined. I will describe “Network ACL” in another article. This article describes the operations of utl_mail and smtp_out_server.
Install Utl_mail:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | [oracle@oradb ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 17 13:54:27 2016 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> @?/rdbms/admin/utlmail.sql Package created. Synonym created. SQL> @?/rdbms/admin/prvtmail.plb Package created. Package body created. Grant succeeded. Package body created. No errors. |
Configure smtp
we specify smtp server with the smtp_out_server parameter. E-mails will be sent via this SMPT server. Prior to that, you must define the relay right for your database server on the corresponding smtp server.
The smtp server can be set with the following command.
1 2 | SQL> alter system set smtp_out_server='192.168.10.100' scope=both sid='*'; System altered. |