综合辅导:在Oracle中发送Email

文章作者 100test 发表时间 2007:03:14 13:44:32
来源 100Test.Com百考试题网


在Oracle中发送email,以下是Oracle提供的例子,供参考.

itpub link:

http://www.itpub.net/showthread.php?threadid=226086

1. CREATE PACKAGE

CREATE OR REPLACE PACKAGE demo_mail IS

----------------------- Customizable Section -----------------------

-- Customize the SMTP host, port and your domain name below.
smtp_host VARCHAR2(256) := smtp.eygle.com.
smtp_port PLS_INTEGER := 25.
smtp_domain VARCHAR2(256) := eygle.com.

-- Customize the signature that will appear in the emails MIME header.
-- Useful for versioning.
MAILER_ID CONSTANT VARCHAR2(256) := Mailer by Eygle.

--------------------- End Customizable Section ---------------------

-- A unique string that demarcates boundaries of parts in a multi-part email
-- The string should not appear inside the body of any part of the email.
-- Customize this if needed or generate this randomly dynamically.
BOUNDARY CONSTANT VARCHAR2(256) := -----7D81B75CCC90D2974F7A1CBD.

FIRST_BOUNDARY CONSTANT VARCHAR2(256) := -- || BOUNDARY || utl_tcp.CRLF.
LAST_BOUNDARY CONSTANT VARCHAR2(256) := -- || BOUNDARY || -- ||
utl_tcp.CRLF.

-- A MIME type that denotes multi-part email (MIME) messages.
MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := multipart/mixed. boundary="||
BOUNDARY || ".
MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3.

-- A simple email API for sending email in plain text in a single call.
-- The format of an email address is one of these:
-- someone@some-domain
-- "Someone at some domain"
-- Someone at some domain
-- The recipients is a list of email addresses separated by
-- either a "," or a "."
PROCEDURE mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2).

-- Extended email API to send email in HTML or plain text with no size limit.
-- First, begin the email by begin_mail(). Then, call write_text() repeatedly
-- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
-- email in non-ASCII or multi-byte character set. End the email with
-- end_mail().
FUNCTION begin_mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT text/plain,
priority IN PLS_INTEGER DEFAULT NULL)
RETURN utl_smtp.connection.


相关文章


Oracle10g认证考试途径详解
在Oracle中实现数据库的复制(二)
产品带动认证·知名IT企业职业认证盘点
Oracle9i的DBCA无法启动问题之解决
综合辅导:在Oracle中发送Email
在Oracle中实现数据库的复制(一)
2006提高ORACLE数据库的查询统计速度
甲骨文任BrianMitchell为亚太区董事长
2006技术指导海量数据库的查询优化及分页算法
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛