| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Mailing Lists -> Oracle-L -> Re: off topic - E-mail from DB
This is a multi-part message in MIME format.
--------------A2CE5A0F804B70F66B6BA0FA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
Oracle 8.1.6 on NT
utl_smtp.sql
have fun.
Pd
prem_at_ibsplc.com wrote:
> > Does anyone tell me is it possible to send e-mails from the Oracle > database, If so how? > we are using Oracle8.0 for the development. > > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: > INET: prem_at_ibsplc.com > > Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California -- Public Internet access / Mailing Lists > -------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an E-Mail message > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing).--------------A2CE5A0F804B70F66B6BA0FA
REM  Copyright (c) 1999 by Oracle Corporation.
REM
REM  NAME
REM    utlsmtp.sql - PL/SQL Package for Simple Mail Transfer Protocol (SMTP)
REM communication (Package Specification of UTL_SMTP)REM
REM MODIFIED (MM/DD/YY) REM jmuller 09/16/99 - Fix bug 708690: final pass REM rpang 08/12/99 - Added exception codes REM rpang 08/12/99 - Fixed comments REM rpang 07/27/99 - Added INVALID_OPERATION exception REM rpang 07/23/99 - Modified datatype of port number to PLS_INTEGER REM rpang 05/19/99 - Created
CREATE OR REPLACE PACKAGE utl_smtp AS
/*******************************************************************
  /*
   * SMTP connection type
   */
  TYPE connection IS RECORD (
    host             VARCHAR2(255),       -- Host name of SMTP server
    port             PLS_INTEGER,         -- Port number of SMTP server
    private_tcp_con  utl_tcp.connection,  -- For internal use only
    private_state    PLS_INTEGER          -- For internal use only
  );
  /*
   * SMTP reply structure
   */
  TYPE reply IS RECORD (
    code     PLS_INTEGER,                 -- 3-digit reply code
    text     VARCHAR2(508)                -- reply text
  );
/* * Exceptions */ invalid_operation EXCEPTION; -- Operation is invalidtransient_error EXCEPTION; -- Transient server error in 400 range permanent_error EXCEPTION; -- Permanent server error in 500 range
invalid_operation_errcode CONSTANT PLS_INTEGER:= -20000; transient_error_errcode CONSTANT PLS_INTEGER:= -20001; permanent_error_errcode CONSTANT PLS_INTEGER:= -20002; PRAGMA EXCEPTION_INIT(invalid_operation, -20000);PRAGMA EXCEPTION_INIT(transient_error, -20001); PRAGMA EXCEPTION_INIT(permanent_error, -20002);
  /**
   * Opens a SMTP connection to a SMTP server.  When connection is made
   * succesfully, the SMTP host name and port number will be stored in
   * the connection.
   *
   * PARAMETERS
   *   host   SMTP host name to connect to
   *   port   port number of the SMTP server to connect to
   *   c      SMTP connection (OUT)
   * RETURN
   *   SMTP connection when connection is established, or
   *   the SMTP reply (welcome) message
   * EXCEPTIONS
   *   transient_error   - transient server error
   *   permanent_error   - permanent server error
   *   invalid_operation - invalid operation
   */
  FUNCTION open_connection(host  IN  VARCHAR2,
                           port  IN  PLS_INTEGER DEFAULT 25,
                           c     OUT connection) RETURN reply;
  FUNCTION open_connection(host  IN  VARCHAR2,
                           port  IN  PLS_INTEGER DEFAULT 25)
                           RETURN connection;                   
  /**
   * Sends a generic SMTP command and retrieves a single reply line.  If
   * multiple reply lines are returned from the SMTP server, the last reply
   * line is returned.
   *
   * PARAMETERS
   *   c     SMTP connection
   *   cmd   SMTP command
   *   arg   optional argument to the SMTP command
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
   *   transient_error   - transient server error
   *   permanent_error   - permanent server error
  /**
   * Sends a generic SMTP command and retrieves multiple reply lines.
   *
   * PARAMETERS
   *   c     SMTP connection
   *   cmd   SMTP command
   *   arg   optional argument to the SMTP command
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
   *   invalid_operation - invalid operation
   */
  FUNCTION command_replies(c     IN OUT NOCOPY connection,
                           cmd   IN            VARCHAR2,
                           arg   IN            VARCHAR2 DEFAULT NULL)
                           RETURN replies;
  /**
   * Sends HELO command.
   *
   * PARAMETERS
   *   c        SMTP connection
   *   domain   domain of the sender
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
   *   transient_error   - transient server error
   *   permanent_error   - permanent server error
  /**
   * Sends EHLO command.
   *
   * PARAMETERS
   *   c        SMTP connection
   *   domain   domain of the sender
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
   *   transient_error   - transient server error
   *   permanent_error   - permanent server error
   *   invalid_operation - invalid operation
   */
  FUNCTION ehlo(c       IN OUT NOCOPY connection,
                domain  IN            VARCHAR2) RETURN replies;
  PROCEDURE ehlo(c       IN OUT NOCOPY connection,
                 domain  IN            VARCHAR2);
  /**
   * Sends MAIL command.
   *
   * PARAMETERS
   *   c           SMTP connection
   *   sender      the sender
   *   parameters  the optional parameters to MAIL command
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
   *   transient_error   - transient server error
   *   permanent_error   - permanent server error
  /**
   * Sends RCPT command.
   *
   * PARAMETERS
   *   c           SMTP connection
   *   recipient   the recipient
   *   parameters  the optional parameters to RCPT command
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
   *   transient_error   - transient server error
   *   permanent_error   - permanent server error
   *   invalid_operation - invalid operation
   */
  FUNCTION rcpt(c          IN OUT NOCOPY connection,
                recipient  IN            VARCHAR2,
                parameters IN            VARCHAR2 DEFAULT NULL) RETURN reply;
  PROCEDURE rcpt(c          IN OUT NOCOPY connection,
                 recipient  IN            VARCHAR2,
                 parameters IN            VARCHAR2 DEFAULT NULL);
  /**
   * Sends DATA command.  The data will be closed by the sequence
   * <CR><LF>.<CR><LF>
   *
   * PARAMETERS
   *   c     SMTP connection
   *   body  the data body
   * RETURN
   *   the SMTP reply after the sequence <CR><LF>.<CR><LF> is sent
   * EXCEPTIONS
   *   transient_error   - transient server error
   *   permanent_error   - permanent server error
/** * Sends DATA command. This call opens the data session that the * caller make subsequent write_data() calls to write large piece of * data, following by close_data() to close the data session. * * PARAMETERS * c SMTP connection * RETURN * the SMTP reply * EXCEPTIONS * transient_error - transient server error * permanent_error - permanent server error * invalid_operation - invalid operation */
  /**
   * Sends data.  This call must be preceeded by the call open_data().
   *
   * PARAMETERS
   *   c      SMTP connection
   *   data   the data body
   * RETURN
   *   None
   * EXCEPTIONS
   *   invalid_operation - invalid operation
   */
  PROCEDURE write_data(c     IN OUT NOCOPY connection,
                       data  IN            VARCHAR2);
  /**
   * Sends DATA command.  This call opens the data session that the
   * caller make subsequent write_data() calls to write large piece of
   * data, following by close_data() to close the data session.
   *
   * PARAMETERS
   *   c   SMTP connection
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
   *   transient_error   - transient server error
   *   permanent_error   - permanent server error
/** * Sends RSET command. * * PARAMETERS * c SMTP connection * RETURN * the SMTP reply * EXCEPTIONS * transient_error - transient server error * permanent_error - permanent server error * invalid_operation - invalid operation */
  /**
   * Sends VRFY command.
   *
   * PARAMETERS
   *   c           SMTP connection
   *   recipient   the reccipient to verify
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
   *   invalid_operation - invalid operation
   */
  FUNCTION vrfy(c          IN OUT NOCOPY connection,
                recipient  IN            VARCHAR2) RETURN reply;
  /**
   * Sends HELP command.
   *
   * PARAMETERS
   *   c         SMTP connection
   *   command   the command to get help message
   * RETURN
   *   the SMTP reply
   * EXCEPTIONS
/** * Sends NOOP command. * * PARAMETERS * c SMTP connection * RETURN * the SMTP reply * EXCEPTIONS * transient_error - transient server error * permanent_error - permanent server error * invalid_operation - invalid operation */
/** * Sends QUIT command. * * PARAMETERS * c SMTP connection * RETURN * the SMTP replyReceived on Tue Oct 17 2000 - 00:02:12 CDT
|  |  |