Sending Mail from the database



You should have an outgoing SMTP server IP to configure sending mail from the database.
I already put it in the database server /etc/hosts as mailhost

sqlplus / as sysdba
@?/rdbms/admin/utlmail.sql
@?/rdbms/admin/prvtmail.plb
grant execute on UTL_MAIL to public;
ALTER SYSTEM SET smtp_out_server = 'mailhost' scope=both;

a simple example

BEGIN
UTL_MAIL.send(sender => 'Yossi@NixonIT.com',
recipients => 'you@address.com',
subject => 'Test Mail',
message => 'Hello World',
mime_type => 'text; charset=us-ascii');
END;
/

For further advanced options such as attachments see in this wiki

Comments

Popular posts from this blog

Data Guard - Changing IP Addresses

Install Oracle Internet Directory (OID) in Standalone mode

Fixing & Registering ORACLE_HOMES in Central Inventory