Re: Request for information on automated notification.

  • From: Raj Jamadagni <rjamya@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Wed, 7 Jul 2004 03:46:32 -0700 (PDT)

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,
    message   IN VARCHAR2) AS
   mailhost VARCHAR2(100) := 'pop3.com.org.net';
   mail_conn utl_smtp.connection;
  PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
  BEGIN
    utl_smtp.write_data(mail_conn, name || ': ' || header || utl_tcp.CRLF);
  END;
 BEGIN
   mail_conn := utl_smtp.open_connection(mailhost);
   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);
  WHEN OTHERS THEN
    raise_application_error(-20101,'The following error has occured: ' || 
sqlerrm);
END;
/



--- Ian Cary <Ian.Cary@xxxxxxxxxxxxxx> wrote:
> 
> There's quite a good example of this on the Ask Tom site
> 


=====
Best Regards
Raj
---------------------------------------------------------
select mandatory_disclaimer from company_requirements;


                
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: