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

Home -> Community -> Usenet -> c.d.o.tools -> UTL_TCP

UTL_TCP

From: Sébastien Rigaud <spendius_at_MailAndNews.com>
Date: Fri, 4 May 2001 05:21:22 -0400
Message-ID: <3AFA1863@MailAndNews.com>

Does it properly work ? Because I've experienced locked sessions EVERY TIME I send a mail thru our mail server, when using this package (I can see in V$ACCESS tens or hundreds of records related to my session, which hangs forever, and to the Java cursors and classes -owned by SYS- used by this package)...

I found the code I use somewhere on the web, here it is: declare

  msg_from    VARCHAR2(11) := 'scperf_at_WW3D';
--msg_to      VARCHAR2;
  msg_to varchar2(30) := 'myLogin_at_ourDomain';
  msg_subject VARCHAR2(33) := 'E-Mail message from your database';
  msg_text    VARCHAR2(31) := 'Test de mail a partir de PL/SQL';
  --
  c utl_tcp.connection;
  rc INTEGER;
BEGIN   c := utl_tcp.open_connection('<our mail server IP>', 25);

  rc := utl_tcp.write_line(c, 'HELO localhost');

  rc := utl_tcp.write_line(c, 'MAIL FROM: '||msg_from);

  rc := utl_tcp.write_line(c, 'RCPT TO: '||msg_to);

  rc := utl_tcp.write_line(c, 'DATA');                 -- Start message body

  rc := utl_tcp.write_line(c, 'Subject: '||msg_subject);
  rc := utl_tcp.write_line(c, '');
  rc := utl_tcp.write_line(c, msg_text);
  rc := utl_tcp.write_line(c, '.');                    -- End of message 
body

  rc := utl_tcp.write_line(c, 'QUIT');

  utl_tcp.close_connection(c);                         -- Close the 
connection
EXCEPTION
  WHEN OTHERS THEN
    raise_application_error(-20000, 'Unable to send mail message from pl/sql');
END;
/

We're using Oracle 8.1.7 on Sun 2.8. Any ideas ?

Thanks !
Regards,
Seb



 Get your FREE web-based e-mail and newsgroup access at:
                http://MailAndNews.com

 Create a new mailbox, or access your existing IMAP4 or  POP3 mailbox from anywhere with just a web browser.


Received on Fri May 04 2001 - 04:21:22 CDT

Original text of this message

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