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

Home -> Community -> Mailing Lists -> Oracle-L -> Send mail from PL/SQL

Send mail from PL/SQL

From: <Roland.Skoldblom_at_ica.se>
Date: Fri, 19 Apr 2002 03:28:18 -0800
Message-ID: <F001.0044936E.20020419032818@fatcity.com>


Hallo,

anyone whom can help me. I would like this code to send email to two recipients, what is missing? Thanks for all help I can get.

PROCEDURE       sendmailtestny2(
                           inRecipient1 IN VARCHAR2,
                                 inRecipient2 in VARCHAR2,
                           inSubject IN VARCHAR2,
                           inMessage IN VARCHAR2,
                           inSender IN VARCHAR2 := 'roland.skoldblom_at_ica.se' )
IS

   crlf VARCHAR2(2) := CHR(13)||CHR(10);    mailhost VARCHAR2(30) := 'asolc78.ica.se';    mail_conn utl_smtp.connection;
   lMessage1 VARCHAR2(200);
   lmessage2 VARCHAR2(200);
BEGIN    lMessage1 := 'From:' || inSender || crlf ||

               'Subject:' || inSubject || crlf ||
               'To:' || inRecipient1 || crlf || '' || crlf ||
                  inrecipient2 || crlf || '' || crlf ||
                                 inMessage || crlf || crlf || '/' || inSender;

     --lMessage2 := 'From:' || inSender || crlf ||
      --         'Subject:' || inSubject || crlf ||
        --       'To:' || inRecipient2 || crlf || '' || crlf ||
          --     inMessage || crlf || crlf || '/' || inSender;

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

   utl_smtp.helo(mail_conn, mailhost);
   utl_smtp.mail(mail_conn, inSender);
   utl_smtp.rcpt(mail_conn, inRecipient1);
   utl_smtp.rcpt(mail_conn, inRecipient2);
   utl_smtp.data(mail_conn, lMessage1);
   utl_smtp.data(mail_conn, lMessage2);
   utl_smtp.quit(mail_conn);

END; Roland

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: Roland.Skoldblom_at_ica.se

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). Received on Fri Apr 19 2002 - 06:28:18 CDT

Original text of this message

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