Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Request for information on automated notification.

Re: Request for information on automated notification.

From: Raj Jamadagni <rjamya_at_yahoo.com>
Date: Wed, 7 Jul 2004 03:46:32 -0700 (PDT)
Message-ID: <20040707104632.37258.qmail@web50008.mail.yahoo.com>


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;
/
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_at_freelists.org put 'unsubscribe' in the subject line.
--
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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US