Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > Oracle
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 31st, 2003, 03:45 AM
Authorized User
Points: 78, Level: 1
Points: 78, Level: 1 Points: 78, Level: 1 Points: 78, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Socorro, NM, USA.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default PL/SQL

   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
  #2 (permalink)  
Old 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
Send a message via Yahoo to SureshHyd

check the following code. I have copied it from some other source.

  msg_from varchar2 := 'oracle',
  msg_to varchar2,
  msg_subject varchar2 := 'E-Mail message from your database',
  msg_text varchar2 := '' )
  c utl_tcp.connection;
  rc integer;
  c := utl_tcp.open_connection('', 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
  when others then
           -20000, 'Unable to send e-mail message from pl/sql because
            of: '|| sqlerrm);
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
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are 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 08:14 PM
PL/SQL help Blue Oracle 0 August 12th, 2003 02:54 PM

All times are GMT -4. The time now is 02:01 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.