|
Category :
Database
Resources -> Database Administration -> Troubleshooting & Solutions
DB Version
:
Oracle 8i /
Oracle 9i
OS Details :
Sun Solaris9
Having problems sending
emails from PLSQL? Here are some troubleshooting tips:
Pre-requisites (1 & 2 below):
(1) Make sure that Java Virtual Machine (JVM) is installed
within the database.
(2)
Load plsql.jar into the Oracle JVM. Use the following command to
load plsql.jar:
(For
unix platforms):
$ loadjava -resolve -user system/<password>@<sid name> $ORACLE_HOME\plsql\jlib\plsql.jar
(3)
Get the email exchange server and port number (Default port number is
usually 25) details from your email management / networking team.
(4) You can write a simple
piece of code to do a quick test
to see if the exchange server is accessible:
declare
conn utl_smtp.connection;
mesg_var varchar2(100);
begin
conn := utl_smtp.open_connection('mail1.dbaxchange.server.com',25);
utl_smtp.helo(conn,'mail1.dbaxchange.server.com');
utl_smtp.mail(conn,'from@fromaddress.com');
utl_smtp.rcpt(conn,'to@toaddress.com');
mesg_var := 'Test Message';
utl_smtp.data(conn,mesg_var);
utl_smtp.quit(conn);
/
|