【Vegas原创】Oracle使用自带的UTL_MAIL发送邮件

Steps to enable Mailing from Database

1.

sqlplus ‘/ as sysdba’

 

2.

SQL>@$ORACLE_HOME/rdbms/admin/utlmail.sql

 

3.

SQL>@$ORACLE_HOME/rdbms/admin/prvtmail.plb


4. Set smtp_server information in init.ora or spfile.ora

SQL>alter system set smtp_out_server = "******";

 

 

How to send an email

1,

sqlplus ‘/ as sysdba’

 

2,

execute  UTL_MAIL.SEND('***@***.**','***@***.**','','','Subject','Content');

 

if want to send an HTML Mail,then:

execute  UTL_MAIL.SEND('***@***.**','***@***.**','','','Subject','Content','text/html; charset=GB2312',3);

 

 

How to grant execute permission to Other Users

 

1,

sqlplus ‘/ as sysdba’

 

2,

 grant execute on sys.UTL_MAIL to whs;

 

3,Login as "whs",execute the same SQL with step2 on How to send an email Paragraph.

 

 

posted @ 2009-03-31 16:52  李济宏(Amadeus)  阅读(172)  评论(0编辑  收藏  举报