Saturday, March 17, 2012
This post gives you an example script to send an E-Mail from Oracle PL/SQL using the UTL_SMTP.
SET SERVEROUTPUT ON;
l_err_msg VARCHAR2 (2000) := NULL;
l_email_text VARCHAR2 (32000) DEFAULT NULL;
p_host_id_address VARCHAR2 (100);
p_remittance_email VARCHAR2 (200) := 'firstname.lastname@example.org';
l_new_line VARCHAR2 (2) := UTL_TCP.crlf;
SELECT UTL_INADDR.get_host_address ('mailhost.shareoracleapps.com')
l_connection := UTL_SMTP.open_connection (p_host_id_address, 25);
UTL_SMTP.helo (l_connection, p_host_id_address);
UTL_SMTP.mail (l_connection, 'Teamsearch@shareoracleapps.com');
UTL_SMTP.rcpt (l_connection, p_remittance_email);
|| 'From: '
|| 'Subject: Test Email'
|| 'To: '
|| 'Content-Type: text/html'
|| 'This is Blog contains the details about Oracle apps Technical and Functional'
fnd_file.put_line (fnd_file.LOG, 'Calling UTL_SMTP.DATA');
UTL_SMTP.DATA (l_connection, l_email_text);
DBMS_OUTPUT.put_line ('Calling UTL_SMTP.quit');
DBMS_OUTPUT.put_line ('Email Sent Successfull.');
DBMS_OUTPUT.put_line ( 'Unexpected Error Occured = '
|| SUBSTR (SQLERRM, 1, 200)
Do you think this Article is useful?
The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.