|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 eison 于 2010/11/29 17:43 编辑
之前在网上抄了个类似的
自己稍微加工了下 ,
多添了几个收件人,本人基本用此程序在一些exception 里面,出现一些问题以便及时处理
程序简单高效,发上来哪天自己要再用直接来copy .
实现简单alert .
PS: 只能在内网使用,2.不能发附件 . GENG牛的功能,牛x人 继续 更贴把 继续分享
- create or replace procedure cux_SEND_MAIL(sender in varchar2 default 'EISON.SUN@XXXX.com',
- recipient1 in varchar2 default 'EISON.SUN@XXXX.com',
- recipient2 in varchar2 default 'a@XXXX.com',
- CC1 in varchar2 default 'EISON.SUN@XXXX.com',
- CC2 in varchar2 default 'AAA@XXXX.com',
- CC3 in varchar2 default 'bbb@XXXX.com',
- subject in varchar2 default 'Eison Test mail',
- message in varchar2 DEFAULT to_char(sysdate,
- 'YYYY/MM/DD HH24:MM:SS')) is
- mailhost varchar2(30) := 'MAIL_server01.xxxx.com';
- -----need modify mail server ,you can get the address from your outlook config.
- c utl_smtp.connection;
- msg varchar2(1000);
- begin
- msg := 'Date: ' || to_char(sysdate, 'YYYY/MM/DD HH24:MM:SS') ||
- UTL_TCP.CRLF || 'From: <' || sender || '>' || UTL_TCP.CRLF ||
- 'Subject: ' || subject || UTL_TCP.CRLF || 'To: <' || recipient1 ||
- '>;<' || recipient2 || '>' || UTL_TCP.CRLF || 'Cc: <' || CC1 ||
- '>;<' || CC2 || '>;<' || CC3 || '>' || '' || UTL_TCP.CRLF ||
- 'Message Content: ' || message || UTL_TCP.CRLF;
- c := utl_smtp.open_connection(mailhost, 25);
- utl_smtp.helo(c, mailhost);
- utl_smtp.mail(c, sender);
- utl_smtp.rcpt(c, recipient1);
- utl_smtp.rcpt(c, recipient2);
- utl_smtp.rcpt(c, CC1);
- utl_smtp.rcpt(c, CC2);
- utl_smtp.rcpt(c, CC3);
- utl_smtp.open_data(c);
- -- utl_smtp.data(c, msg);
- ---UTL_SMTP.WRITE_DATA(c, UTL_TCP.CRLF ||' Pls pay attention the msg,^%^ !'||SYSDATE|| UTL_TCP.CRLF);
- utl_smtp.write_raw_data(c,
- utl_raw.cast_to_raw('Dears' || msg ||
- utl_tcp.crlf));
- utl_smtp.write_raw_data(c,
- utl_raw.cast_to_raw('Dears:' || utl_tcp.crlf ||
- 'Pls pay attnetion to the message! ' ||
- utl_tcp.crlf || utl_tcp.crlf || msg));
- utl_smtp.write_raw_data(c,
- utl_raw.cast_to_raw(UTL_TCP.CRLF ||
- '--------------------End------------------'));
- utl_smtp.close_data(c);
- utl_smtp.quit(c);
- end cux_SEND_MAIL;
- /
- 调用方法: COPY 以上代码,修改 收件地址和 内网mail_server address and receiver &cc
- 编译执行后。 然后调用即可。 begin cux_SEND_MAIL ;end;
- OR you can call the programe as follow, which only show to new birds
-
- BEGIN
- CUX_SEND_MAIL(SENDER => 'A@XX.COM',
- recipient1 => 'B@XX.COM');
- END;
复制代码
|
|