Home » SQL & PL/SQL » SQL & PL/SQL » sending mail from pl/sql programming
sending mail from pl/sql programming [message #22935] Wed, 06 November 2002 22:36 Go to next message
sha
Messages: 84
Registered: July 2002
Member
Hi,
Can anybody help me.How to send email from oracle using pl/sql programming?If possible send me the sample program also.I would like to know which are the files to be executed and to which user I should connect to execute those files?I need it urgent.Specify the steps clearly, as I am learning now only.
I got this error when I executed the program.
ORA-29540: class oracle/plsql/net/TCPConnection does not exist
thanx
regards,
shastri
Re: sending mail from pl/sql programming [message #22942 is a reply to message #22935] Thu, 07 November 2002 02:07 Go to previous messageGo to next message
Keith
Messages: 88
Registered: March 2000
Member
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:255615160805
Re: sending mail from pl/sql programming [message #23782 is a reply to message #22935] Mon, 06 January 2003 07:44 Go to previous message
Vijay
Messages: 116
Registered: September 1999
Senior Member
DECLARE

SendorAddress Varchar2(30) := 'potkin@impactcomputersltd.com';
ReceiverAddress varchar2(30) := 'info@dbaoncall.net';
EmailServer varchar2(30) := 'xxx.xxx.xxx.xxx';
Port number := 25;

conn UTL_SMTP.CONNECTION;

crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );

mesg VARCHAR2( 4000 );
mesg_body varchar2(4000);

cursor c1 is
select d.deptno,count(e.empno)
from dept d,
emp e
where e.deptno(+) = d.deptno
group by d.deptno
order by 1;

BEGIN

conn:= utl_smtp.open_connection( EmailServer, Port );
utl_smtp.helo( conn, EmailServer );
utl_smtp.mail( conn, SendorAddress);
utl_smtp.rcpt( conn, ReceiverAddress );

mesg:=

'Date: '||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' )|| crlf ||
'From:'||SendorAddress|| crlf ||
'Subject: Sending Mail From Database' || crlf ||
'To: '||ReceiverAddress || crlf ||
'' || crlf ||
'Dept No' ||' Count ' ||crlf||
'----------------------' ||' ------' ||crlf;

for c1rec in c1 LOOP
mesg := mesg || rpad(c1rec.deptno,22,' ') ||'
'||rpad(c1rec.count,10,' ') || crlf;
end loop;

utl_smtp.data( conn, mesg );
utl_smtp.quit( conn );

END;
Previous Topic: pl/sql table
Next Topic: Strange Queries
Goto Forum:
  


Current Time: Fri Jun 05 12:13:33 CDT 2026