PreviousTopHomeNext
  ORAID! | Oracle | How-To | Tips & Trick | Links

 










 
Sent by : Holly





HOWTO:Send Mail within database
Using Oracle 8i, we can send mail using our PL/SQL block.

DECLARE
conn UTL_SMTP.CONNECTION;
crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
mesg VARCHAR2( 1000 );
BEGIN
conn:= utl_smtp.open_connection( '10.126.10.51', 25 );
utl_smtp.helo( conn, '10.126.10.51' );
utl_smtp.mail( conn, 'jhon.doe@oraid.com' );
utl_smtp.rcpt( conn, 'margaret@oraid.iwarp.com' );
utl_smtp.rcpt( conn, 'cc:bill@oraid.net' );
utl_smtp.rcpt( conn, 'bcc:bob@oraid.org' );
mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
'From: John Doe <jhon.doe@oraid.com>' || crlf ||
'Subject:Testing' || crlf ||
'To: Margaret <margaret@oraid.iwarp.com>' || crlf ||
'Cc: Bill <cc:bill@oraid.net>' || crlf ||
'Bcc: Bob <bcc:bob@oraid.org>' || crlf || '' || crlf ||
' This is just a test, please disregard. ' || crlf ||
'****************************************';
utl_smtp.data( conn, mesg );
utl_smtp.quit( conn );
END;

Note :
'10.126.10.51' is a SMTP server.
This mail is sent by John Doe, to Margaret, cc to Bill, and bcc to Bob.












  About SyahID  
mail to webmaster Copyright 1999-2001 SyahID, Inc. All rights reserved.