RE: Sending Email from Oracle

RE: Sending Email from Oracle

 

  

Does this work for Oracle8i.

-----Original Message-----
From: Shruti K. Mittal [mailto:oracledba-ezmlmshield-x54677989.[Email address protected]
Sent: Monday, August 16, 2004 4:42 PM
To: LazyDBA Discussion
Subject: RE: Sending Email from Oracle


Hello!

UTL_SMTP will be yor required package.

see the attached procedure if it helps you

CREATE OR REPLACE PROCEDURE mailout
(
Sender IN VARCHAR2,
toRecipient IN VARCHAR2,
ccRecipient IN VARCHAR2,
Subject IN VARCHAR2,
Message IN VARCHAR2
)
IS
crlf VARCHAR2 (2) := UTL_TCP.crlf;
connection UTL_SMTP.connection;
mailhost VARCHAR2 (30) := 'smtp.your.server.name';
header VARCHAR2 (1000);
BEGIN
--
-- Start the connection.
--
connection := UTL_SMTP.open_connection (mailhost, 25);
header :=
'Date: '
|| TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss')
|| crlf
|| 'From: "Oracle Database" <'
|| sender
|| '>'
|| crlf
|| 'Subject: '
|| subject
|| crlf
|| 'Organization: Your Company NAme'
|| crlf
|| 'To: '
|| toRecipient
|| crlf
|| 'CC: '
|| ccRecipient
|| crlf
|| 'Disposition-Notification-To: "Oracle Database" <'
|| sender
|| '>'
|| crlf
|| 'Importance: High';
--
-- Handshake with the SMTP server
--
UTL_SMTP.helo (connection, mailhost);
UTL_SMTP.mail (connection, sender);
UTL_SMTP.rcpt (connection, toRecipient);
UTL_SMTP.rcpt (connection, ccRecipient);
UTL_SMTP.open_data (connection);

--
-- Write the header
--
UTL_SMTP.write_data (connection, header);
--
-- The crlf is required to distinguish that what comes next is not simply
part of the header..
--
UTL_SMTP.write_data (connection, crlf || TRIM(Message) || crlf || crlf ||
'Best Regards,' || crlf || 'Shruti K. Mittal');
UTL_SMTP.close_data (connection);
UTL_SMTP.quit (connection);
END;
/



regards
./shruti

-----Original Message-----
From: Rene Zhao
[mailto:oracledba-ezmlmshield-x58778742.[Email address protected]
Sent: Monday, August 16, 2004 8:09 PM
To: LazyDBA Discussion
Subject: Sending Email from Oracle


Hi,

Can anybody tell me how to send email from Oracle? I know there's a
built-in package but can't recall the name. I'm using Oracle9i
Enterprise Edition Release 9.2.0.1.0 on Windows 2003.

Thanks,
RZ


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html




--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these terms:http://www.lazydba.com/legal.html


Oracle LazyDBA home page