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 -> Re: Sending emails with pl/sql.

Re: Sending emails with pl/sql.

From: Menno Jonkers <menno_at_SP.tryllian.AM.com>
Date: 2000/05/11
Message-ID: <ilgdf8.g83.ln@litas.intra.tryllian.net>#1/1

(this was posted before)

Hi,

For sending an email from PL/SQL in Oracle 8i you may want to look at the standard package UTL_SMTP. See it's description in Oracle8i Supplied PL/SQL Packages Reference, Release 2 (8.1.6), A76936-01.

See below for an example of its use (cited from the Reference manual). I haven't used it myself though.

Regards,

Menno

Example

The following code example illustrates how the SMTP package might be used by an application to send email. The application connects to an SMTP server at port 25 and sends a simple text message.

PROCEDURE send_mail (sender IN VARCHAR2,

                     recipient IN VARCHAR2,
                     message   IN VARCHAR2)
IS

    mailhost VARCHAR2(30) := 'mailhost.mydomain.com';     mail_conn utl_smtp.connection;

BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);

    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender);
    utl_smtp.rcpt(mail_conn, recipient);
    utl_smtp.data(mail_conn, message);
    utl_smtp.quit(mail_conn);

EXCEPTION
    WHEN OTHERS THEN Received on Thu May 11 2000 - 00:00:00 CDT

Original text of this message

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