This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes SMTP Authentication in Oracle Mail using utl_smtp package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "SMTP Authentication in Oracle Mail using utl_smtp package" Watch "SMTP Authentication in Oracle Mail using utl_smtp package" New topic
Author

SMTP Authentication in Oracle Mail using utl_smtp package

Prakash Vaidyanathan
Greenhorn

Joined: Oct 10, 2003
Posts: 8
Hi,
I have a procedure that sends mail from oracle database to specified mail id. But my smtp server needs authentication. Can anyone tell me how to check for authentication using utl_smtp.
The following is the code i am using for sending mails:
CREATE OR REPLACE PROCEDURE SEND_MAIL (
msg_to varchar2,
msg_subject varchar2,
msg_text varchar2 )
IS
c utl_smtp.connection;
rc integer;
msg_from varchar2(50) := 'xxx@xxx.com'; -- dummy mail id & will be replaced with correct mail id at time of execution.
mailhost VARCHAR2(30) := 'cgnnt003'; -- local database host

BEGIN
c := utl_smtp.open_connection(mailhost, 25); -- SMTP on port 25
utl_smtp.helo(c, mailhost);
utl_smtp.mail(c, msg_from);
utl_smtp.rcpt(c, msg_to);

utl_smtp.data(c,'From: Oracle Database' || utl_tcp.crlf ||
'To: ' || msg_to || utl_tcp.crlf ||
'Subject: ' || msg_subject ||
utl_tcp.crlf || msg_text);
utl_smtp.quit(c);

EXCEPTION
WHEN UTL_SMTP.INVALID_OPERATION THEN
dbms_output.put_line(' Invalid Operation in Mail attempt
using UTL_SMTP.');
WHEN UTL_SMTP.TRANSIENT_ERROR THEN
dbms_output.put_line(' Temporary e-mail issue - try again');
WHEN UTL_SMTP.PERMANENT_ERROR THEN
dbms_output.put_line(' Permanent Error Encountered.');
END;
/

Thanks


V.Prakash
Ravikumar Chellaboina
Greenhorn

Joined: May 14, 2004
Posts: 9
Prakash,

You need cross check with your Mail admin and add your IP Address in the Mail Server so that you can send mails from your IP. I do not think you can use authentication using this package. For me the above procedure worked.

Good Luck


Ravi <img src="smile.gif" border="0"> <br />---------<br />Go Get it..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SMTP Authentication in Oracle Mail using utl_smtp package
 
Similar Threads
Callable Statement
SQL
Callable Statement
Oracle mail
Oracle Mail Error