Sending e-mail from Oracle Server in 10g
来源:互联网 发布:如何设计一门编程语言 编辑:程序博客网 时间:2024/06/05 22:30
ORACLE DATABASE ADMINISTRATOR
Sending e-mail from Oracle Server
Gregory Williams
06.22.2006
Rating: -3.66- (out of 5)
In order to send e-mail within 10g you must install and set up the UTL_MAIL package.
UTL_MAIL isn't installed when the database is installed because the SMTP_OUT_SERVER parameter must be configured. Listing 1 shows how to install UTL_MAIL and the results from the script. You must connect to the database as user SYS and run the two scripts identified in the listing.
Listing 1. Installation of UTL_MAIL
SQL> connect sys/password as sysdbaConnected. SQL> @$ORACLE_HOME/rdbms/admin/utlmail.sql Package created. Synonym created. SQL> @$ORACLE_HOME /rdbms/admin/prvtmail.plb Package body created. No errors.
Next, the SMTP_OUT_SERVER parameter must be configured. You must connect to SYS and then use the alter system command to configure SMTP_OUT_SERVER parameter as shown here:
SQL> alter system set smtp_out_server = '<ip-address:port' scope=Both; System altered.
That's it! The installation and setup for UTL_MAIL is complete. The UTL_MAIL package only has one procedure, called Send, for sending e-mail (see Listing 2 for the syntax for the Send procedure). This package bundles the e-mail message and sends it to the UTL_SMTP package, and then the e-mail message is sent to the SMTP server.
Listing 2. Syntax for UTL_MAIL.SEND
UTL_MAIL.SEND( sender IN VARCHAR2, recipients IN VARCHAR2, cc IN VARCHAR2 DEFAULT NULL, bcc IN VARCHAR2 DEFAULT NULL, subject IN VARCHAR2 DEFAULT NULL, message IN VARCHAR2, mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=us-ascii', priority IN PLS_INTEGER DEFAULT NULL);
Examples: I've created a database trigger that will send an e-mail using UTL_MAIL (see Listing 3).
Listing 3. Database shutdown using UTL_MAIL
CREATE OR REPLACE TRIGGER SCOTT.db_shutdownbefore shutdown on databasebegin utl_mail.send( sender => 'gjwilliams01@yahoo.com', recipients => ' gjwilliams01@yahoo.com', subject => 'Testing utl_mail', message => 'The receipt of this email means'|| ' that shutting down the database'|| ' works for UTL_MAIL ' );end;/
Conclusion
There are two other procedures within the UTL_MAIL package that make life easy: UTL_MAIL.ATTACH_VARCHAR2 and UTL_MAIL.ATTACH_RAW. These procedures are for varchar2 and raw attachments, respectively.
- Sending e-mail from Oracle Server in 10g
- Sending e-mail from Oracle
- Sending e-mail with attachments from an ASP.NET page
- Sending E-mail using C#
- Oracle 10g java.lang.Exception: Exception in sending Request :: null
- Oracle 10g java.lang.Exception: Exception in sending Request :: null
- Oracle 10g java.lang.Exception: Exception in sending Request :: null
- java.lang.Exception: Exception in sending Request :: null (oracle 10g)
- oracle 10g 登录em后,提示java.lang.Exception Exception in sending Request null
- oracle 10g提示java.lang.Exception Exception in sending Request null解决方案
- Oracle 10g console控制台报错: java.lang.Exception: Exception in sending Request :: null
- 3-6. Sending an E-mail
- Sending mail from AX using .NET Framework.
- 【oracle】oracle 10g 登录em后,提示java.lang.Exception: Exception in sending Request :: null,解决办法
- Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail (Outlook)
- win7oracle 10g安装 java.lang.Exception: Exception in sending Request :: null
- Greetings in Letters and E-Mail Messages
- Closings in Letters and E-Mail Messages
- windows ce下playsound播放失败的原因
- J2SE5.0的新特性:ProcessBuilder
- .NET平台下WEB应用程序的部署(安装数据库和自动配置)
- sqlserver如何使用数据链路查询
- .Net中的反射使用入门
- Sending e-mail from Oracle Server in 10g
- 第三课 WebSphere Studio应用开发
- 事务入门
- 111
- 第四课 Java Servlet技术
- 第五课 JSP技术
- 在DLL组件中附加图片等资源,并在程序中引用_1
- Bye,brothers! ——写在公司裁员的时刻
- 权限系统概要