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: Off-Topic: How to send email from PL/SQL

RE: Off-Topic: How to send email from PL/SQL

From: <saj.raza_at_qxl.com>
Date: Thu, 14 Dec 2000 11:33:46 -0000
Message-Id: <10710.124549@fatcity.com>


If I remember correctly, just do a second call to utl_smtp.rcpt with a different recipient address

eg
 utl_smtp.rcpt(mail_conn, recipient1);

utl_smtp.rcpt(mail_conn, recipient2);

Saj

	-----Original Message-----
	From:	CHAN Chor Ling Catherine (CSC) [SMTP:clchan_at_nie.edu.sg]
	Sent:	Thursday, December 14, 2000 10:36 AM
	To:	Multiple recipients of list ORACLE-L
	Subject:	RE: Off-Topic: How to send email from PL/SQL

	Hi Arun,

	The PL/SQL code is below.  It does not seem to be able to cc email. 

	Qn : Has anyone successfully sent and cc emails in PL/SQL ? Please
help.
	Thanks.

	Regds,
	Chorling

	DECLARE

	       c utl_smtp.connection;

	 

	       PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2)
AS

               BEGIN                  utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);

               END;                        BEGIN                c := utl_smtp.open_connection('smtp-server.acme.com'); -- your

	smtp server            
	       utl_smtp.helo(c, 'foo.com');         -- your domain

	       utl_smtp.mail(c, 'sender_at_foo.com');

	       utl_smtp.rcpt(c, 'recipient_at_foo.com');

	       utl_smtp.open_data(c);

	       send_header('From',    '"Sender" <sender_at_foo.com>');

	       send_header('To',      '"Recipient" <recipient_at_foo.com>');

	       send_header('Subject', 'Hello');

	       utl_smtp.write_data(c, utl_tcp.CRLF || 'Hello, world!');

	       utl_smtp.close_data(c);

	      utl_smtp.quit(c);

	    EXCEPTION

	       WHEN utl_smtp.transient_error OR utl_smtp.permanent_error
THEN                  utl_smtp.quit(c);

                 raise_application_error(-20000,

                   'Failed to send mail due to the following error: ' || sqlerrm);

             END;           

			-----Original Message-----
			From:	arun_at_ssind.stpn.soft.net
	[mailto:arun_at_ssind.stpn.soft.net]
			Sent:	Thursday, December 14, 2000 6:11 PM

			Hi,

			Can you send the details how you implemented this.

			Thanks and Regards
			Arun

			----- Original Message -----
			From: "CHAN Chor Ling Catherine (CSC)" <    >
			To: "Multiple recipients of list ORACLE-L"
	<ORACLE-L_at_fatcity.com>
			Sent: Thursday, 14 December, 2000 01:31 PM
			Subject: Re: Off-Topic: How to send email from
PL/SQL
> Hi
			>

> I've tried using the package utl_smtp. It works.
>
> Regds,
> ChorLing
> -----Original Message-----
> From: CHAN Chor Ling Catherine (CSC)
> Sent: Thursday, December 14, 2000 3:26 PM
> To: 'ORACLE-L_at_fatcity.com'
> Subject: Off-Topic: How to send email from PL/SQL
>
> Hi,
>
> Is it possible to send email in PL/SQL ? Is there
any Oracle function that
> send email in PL/SQL ? If not, I guess I've to
write the email information
> into a table, use a C-program to extract the
information in the table and
> email it to the sender. Any advice ? Thanks in
advance. >
> Regds,
> Chorling
> --
> Please see the official ORACLE-L FAQ:
http://www.orafaq.com
> --
> Author: CHAN Chor Ling Catherine (CSC)
> INET: clchan_at_nie.edu.sg
>
> 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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: CHAN Chor Ling Catherine (CSC) INET: clchan_at_nie.edu.sg 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). **********************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.

This footnote also confirms that this email message has been swept by Received on Thu Dec 14 2000 - 05:33:46 CST

Original text of this message

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