UTL_SMTP.OPEN_CONNECTION(MAILHOST, 25);

1,486 views
Skip to first unread message

colin

unread,
Sep 1, 2010, 10:01:11 PM9/1/10
to Oracle PL/SQL
I have a couple of database procedures using
UTL_SMTP.OPEN_CONNECTION(MAILHOST, 25); that have been in use for a
few years with mailhost defined as an ip address (e.g.
nnn.nnn.nnn.nnn) sending emails when a count was low. Sometime in the
past few months they stopped working. The database is updated from a
java application that is using the same ip address to send emails
without any problem. The system admin tells me there has been no
change to the mail server; the database admin tells me there's been no
change to the oracle set-up.
If I change the ip address in the procedures to add another dot at the
end (e.g. nnn.nnn.nnn.nnn.) the emails are sent again.
Can anyone suggest why the ip address no longer works?

Michael Moore

unread,
Sep 2, 2010, 6:55:32 PM9/2/10
to oracle...@googlegroups.com
try
c   := UTL_SMTP.open_connection( 'localhost', 25 );


--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle...@googlegroups.com
To unsubscribe from this group, send email to
Oracle-PLSQL...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

colin

unread,
Sep 2, 2010, 7:42:10 PM9/2/10
to Oracle PL/SQL


On Sep 3, 8:55 am, Michael Moore <michaeljmo...@gmail.com> wrote:
> try
> c   := UTL_SMTP.open_connection( 'localhost', 25 );

The procedure, which worked OK for the last few years (I've obscured
the ip address), is:

/*START SEND_MAIL PROCEDURE*/
PROCEDURE SEND_MAIL(PRECIPIENT IN VARCHAR2,PSUBJECT IN
VARCHAR2,PMESSAGE IN VARCHAR2)
IS
MAILHOST CONSTANT VARCHAR2(30) := 'xxx.xx.xxx.x';
CRLF CONSTANT VARCHAR2(2):= CHR(13) || CHR(10);
MESG VARCHAR2(1000);
PSENDER VARCHAR2(255);
TOADDRESS VARCHAR2(500);
MAIL_CONN UTL_SMTP.CONNECTION;
BEGIN
SELECT CXSENDEREMAIL INTO PSENDER FROM TXDRUGGLOBALS;
MAIL_CONN := UTL_SMTP.OPEN_CONNECTION(MAILHOST, 25);
MESG := 'DATE: ' ||TO_CHAR( SYSDATE, 'DD MON YY HH24:MI:SS') ||
CRLF ||'FROM: '|| PSENDER || CRLF ||'SUBJECT: '|| PSUBJECT || CRLF
||'TO: '||TOADDRESS || CRLF || '' || CRLF || PMESSAGE;
UTL_SMTP.HELO(MAIL_CONN, MAILHOST);
UTL_SMTP.MAIL(MAIL_CONN, '<'||PSENDER||'>');
UTL_SMTP.RCPT(MAIL_CONN, '<'||PRECIPIENT||'>');
UTL_SMTP.DATA(MAIL_CONN, MESG);
UTL_SMTP.QUIT(MAIL_CONN);
DBMS_OUTPUT.PUT_LINE('MAIL SENT SUCESSFULLY.');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/*END SEND_MAIL PROCEDURE*/

Richard Pascual

unread,
Sep 3, 2010, 12:33:57 PM9/3/10
to oracle...@googlegroups.com
I understand that the *code* has not changed, but how about your database platform? Have you upgraded? For example, Oracle 11g has made some very significant changes to the way it handles networking operations. I recently wrote some PL/SQL code using the UTL_HTTP package on an 11g server and had to do some significant work developing an ACL (Access Control List) to allow the networking traffic to even happen from the database server... something that didn't have to even be considered on 10g or 9i.


Rich Pascual
Database Programmer 
IT Systems Management
U.C. Berkeley



--
Reply all
Reply to author
Forward
0 new messages