| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Request for information on automated notification.
since I don't expect to be sent large PDF/TIFF/images as attachments as notification on my cell
phone, I use following procedure to send short emails from monitoring routines
This is adapted from Tom's site. Since I am using 9ir2, and java is loaded in the system, nothing else is required. Plus as this is a stored procedure, I can use it in regular pl/sql blocks.
CREATE OR REPLACE PROCEDURE SYS.send_email
( sname in varchar2,
sender IN VARCHAR2,
rname in varchar2,
recipient IN VARCHAR2,
subject IN VARCHAR2,
utl_smtp.helo(mail_conn,mailhost);
utl_smtp.mail(mail_conn,sender); -- sender
utl_smtp.rcpt(mail_conn,recipient); -- recipient
utl_smtp.open_data(mail_conn);
send_header('From', '"' || sname || '" <'|| sender ||'>');
send_header('To', '"' || rname || '" <'|| recipient ||'>');
send_header('Subject', subject);
utl_smtp.write_data(mail_conn, utl_tcp.CRLF||message);
utl_smtp.close_data(mail_conn);
utl_smtp.quit(mail_conn);
EXCEPTION
WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN utl_smtp.quit(mail_conn);
raise_application_error(-20100, 'Failed to send mail due to the following error: ' ||
sqlerrm);
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Wed Jul 07 2004 - 05:43:07 CDT
![]() |
![]() |