Chinaunix首页 | 论坛 | 博客
  • 博客访问: 261036
  • 博文数量: 47
  • 博客积分: 1444
  • 博客等级: 上尉
  • 技术积分: 585
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-14 15:10
文章分类
文章存档

2009年(20)

2008年(27)

我的朋友

分类:

2009-11-11 14:42:26

Sending email from the database with the Utl_Smtp package
The Utl_Smtp package provides all the primitives required to send email (with character and/or binaray attachments) by making calls from database PL/SQL. The Utl_Smtp primitives are relatively low level, and even a simple task like sending a plain text email with no attachments requires a number of calls. The package maildemo in provides a wrapper around Utl_Smtp.

Note: it uses the Utl_Encode package which is new in Oracle9i. An alternative version of maildemo for Oracle8i is avaiable in This uses an explicit implementation of encoding available in .

The maildemo package presents a higher level API for just such simple tasks making it easy to...

  • send a short plain text email with no attachments via a single call
  • send a long email in plain text or HTML by...
    • addressing it and setting the message MIME-type
    • defining the message piecewise
  • send an email with attachments by...
    • addressing it and setting the message MIME-type to MULTIPART
    • defining the message piecewise
    • adding character attachment(s) with defined MIME-type
    • adding binary attachment(s) with defined MIME-type and encoding scheme
    • stating whether each attachment is to be inline or not
  • send an email in a multibyte character set (eg for Chinese, Japanes or Korean)
The maildemo package thus illustrates the use of the lower level Utl_Smtp API. (It uses about half of the available primitives.) It is not however intended to be a complete programmatic equivalent of an interactive email client. Such a package is under consideration, in the first instance for exposure on OTN and then possibly for inclusion in a database release.

The anonymous blocks in and in for Oracle8i illustrate the use of the maildemo API.

 

阅读(900) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~