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

at Tuesday, August 28, 2012  

0 comments:

Post a Comment

Powered by Blogger.