Configuring UTL_MAIL in Oracle Database: A Step-by-Step Guide

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 user
sqlplus '/ 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.ora
alter 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 users
sqlplus '/ 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;

1 thought on “Configuring UTL_MAIL in Oracle Database: A Step-by-Step Guide

  1. Pingback: Schedule monitor archive gap script for Dataguard physical standby sync | Smart way of Technology

Leave a Reply