How to setup the UTL Mail package in Oracle Database
UTL_MAIL is package in SYS schema which is able to used for sending mail in Oracle. You can send mail from UTL_MAIL by using code in your package.
Steps to Configure the UTL MAIL in Oracle
1. Connect with sysdba usersqlplus '/ as sysdba'
2. Execute the utlmail.sql script@$ORACLE_HOME/rdbms/admin/utlmail.sql
3. Execute the prvtmail.plb script@$ORACLE_HOME/rdbms/admin/prvtmail.plb
4. Set smtp_server information in init.ora or spfile.oraalter system set smtp_out_server = 'SMTP_SERVER_IP_ADDRESS:SMTP_PORT' scope=both;
Note:25 = Default SMTP Port
How to send an email with UTL_MAIL package in Oracle
1. Connect with the user or sysdba userssqlplus '/ as sysdba'
2. UTL Mail has send procedure for sending the mail.exec utl_mail.send(sender => 'sunny@wordpress.com', recipients => 'sunny@wordpress.com', subject => 'Test subject', message => 'Test message');
3. Check the email id, to verify the email receipt.
Note: Access grant to SCOTT user for UTL_MAIL package.grant execute permission on UTL_MAIL to SCOTT;
Pingback: Schedule monitor archive gap script for Dataguard physical standby sync | Smart way of Technology