|
|
 |
| Oracle General Oracle database discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Oracle section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

July 31st, 2003, 04:45 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Location: Socorro, NM, USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
PL/SQL
Hi,
I am trying to develop a system where it has some data parsed from XML document and stored in Oracle. The system should process the data and send e-mail to the users. I was wondering, since I am new to PL/SQL, how to use stored procedures written in PL/SQL to send e-mails. I would truly appreciate any help or suggestions for this problem.
Thank you
|

March 3rd, 2005, 10:54 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Location: Hyderabad, Andhra Pradesh, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
check the following code. I have copied it from some other source.
CREATE OR REPLACE PROCEDURE SEND_MAIL (
msg_from varchar2 := 'oracle',
msg_to varchar2,
msg_subject varchar2 := 'E-Mail message from your database',
msg_text varchar2 := '' )
IS
c utl_tcp.connection;
rc integer;
BEGIN
c := utl_tcp.open_connection('127.0.0.1', 25); -- open the SMTP port 25 on local machine
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'HELO localhost');
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'MAIL FROM: '||msg_from);
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'RCPT TO: '||msg_to);
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'DATA'); -- Start message body
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'Subject: '||msg_subject);
rc := utl_tcp.write_line(c, '');
rc := utl_tcp.write_line(c, msg_text);
rc := utl_tcp.write_line(c, '.'); -- End of message body
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
rc := utl_tcp.write_line(c, 'QUIT');
dbms_output.put_line(utl_tcp.get_line(c, TRUE));
utl_tcp.close_connection(c); -- Close the connection
EXCEPTION
when others then
raise_application_error(
-20000, 'Unable to send e-mail message from pl/sql because
of: '|| sqlerrm);
END;
/
show errors
-- Examples:
set serveroutput on
exec send_mail(msg_to =>'orafaq@orafaq.org');
exec send_mail(msg_to =>'orafaq@orafaq.org', -
msg_text=>'Look Ma, I can send mail from plsql' - );
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| PL/SQL |
Somesh |
ASP.NET 1.0 and 1.1 Basics |
7 |
December 15th, 2006 05:49 PM |
| PL/SQL Cursor help |
Wikked |
Oracle |
1 |
March 12th, 2005 01:19 AM |
| PL/SQL i need help |
loveboy23 |
Oracle |
3 |
January 6th, 2005 01:14 AM |
| PL/SQL help |
carly_1 |
Oracle |
1 |
October 19th, 2003 09:14 PM |
| PL/SQL help |
Blue |
Oracle |
0 |
August 12th, 2003 03:54 PM |
|
 |