`

Thanks for the question regarding "About utl_smtp", version 8.1.7

 
阅读更多
You Asked (Jump to Tom's latest followup)
Hi Tom,

I created the procedure send_mail as in your book in the user System. 

create or replace procedure send_mail
( p_sender in varchar2,
  p_recipient in varchar2,
  p_message in varchar2 )
as
   l_mailhost varchar2(255) := '10.228.1.75' ;
   l_mail_conn utl_smtp.connection ;
begin
   l_mail_conn := utl_smtp.open_connection(l_mailhost, 25) ;
   utl_smtp.helo(l_mail_conn, l_mailhost) ;
   utl_smtp.mail(l_mail_conn, p_sender) ;
   utl_smtp.rcpt(l_mail_conn, p_recipient ) ;
   utl_smtp.open_data(l_mail_conn) ;
   utl_smtp.write_data(l_mail_conn, p_message ) ;
   utl_smtp.close_data(l_mail_conn) ;
   utl_smtp.quit(l_mail_conn );
   dbms_output.put_line('Message send to the user successfully') ;
end ;

The procedure compiled without any error. I call the above procedure in the same 
user as :

begin
   send_mail('vrbala@visto.com',
        'vr_bala@yahoo.com',
        'This is the test message from oracle server' ) ;
end ;

I got the following error. What should i do to run this.

ORA-20002: 554 Relay rejected for policy reasons.
ORA-06512: at "SYS.UTL_SMTP", line 86
ORA-06512: at "SYS.UTL_SMTP", line 223
ORA-06512: at "SYSTEM.SEND_MAIL", line 12
ORA-06512: at line 2

Thanks,
Bala 
and we said...
Talk to your system and or network administrator.  This is 100% an smtp 
configuration issue.  Your host (10.228.1.75) is not permitted to relay email 
(to prevent spammers from using you as a jump off point).  You need to find the 
valid smtp server within your organization. 
Reviews
ThanksDecember 03, 2001
Reviewer: Balasubramanian from Singapore
Thanks for immediate response. Also is there any way to
check validity of smtp server using oracle procedures. 
Because the administrator told this is the correct smpt
server.

Thanks,
Bala 

Followup:
You did check the "validity" of the SMTP server -- you got the message back 
"relaying not allowed".  Your smtp server is simply NOT allowed to relay to 
hosts outside of its domain.  You can telnet right to the SMTP server to prove 
this to yourself.

The elements in bold are what you type in, please use your hostname of course.  
You should get the same output as you did from Oracle -- indicating simply that 
your server in visto.com is not allowed to relay to yahoo.com


$ telnet aria-dev 25
Trying 138.2.5.52...
Connected to aria-dev.us.oracle.com.
Escape character is '^]'.
220 aria-dev.us.oracle.com ESMTP Sendmail 8.9.3+Sun/8.9.1; Mon, 3 Dec 2001 
09:41:19 -0500 (EST)
helo aria-dev
250 aria-dev.us.oracle.com Hello aria-dev.us.oracle.com [138.2.5.52], pleased to 
meet you
mail from: tkyte@us.oracle.com
250 tkyte@us.oracle.com... Sender ok
rcpt to: Thomas.Kyte@oracle.com
250 Thomas.Kyte@oracle.com... Recipient ok
data
354 Enter mail, end with "." on a line by itself
this is a test
.
250 JAA17566 Message accepted for delivery
quit
221 aria-dev.us.oracle.com closing connection
Connection closed by foreign host.
 

<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script> Relaying Denied fixesDecember 03, 2001
Reviewer: Andy Finkenstadt from Saint Charles MO
Tell your system adminstrator to allow the IP address for the database server 
initiating the email to relay, by adding the address to (typically) 
/etc/mail/relay-domains.

The relay prohibition comes most restrictively from that lack, or from not using 
an @locally.relayable.domain sender address if the administration is using 
FEATURE(relay_local_from).
 

Ora-20001 :450 when executing procedure.March 31, 2003
Reviewer: Vivek Sharma from Bombay, India
Hi Tom,

I am receiveing ora-20001 :450 error while executing a procedure. But no help is 
provided on Metalink for this. The content of my procedure is

PROCEDURE mail_job_check IS                      
    v_msg varchar2 (10000);    
    mailhost  varchar2(30) := '172.6.49.8' ;
    mail_conn utl_smtp.connection;        
crlf      varchar2(2):= CHR(13) || CHR(10);     
mesg      varchar2(20000);
c_mesg    varchar2(20000); 
a_mesg    varchar2(20000);
mail_id   user_info.ui_email%type;    
v_isin    varchar2(10000);    
c_isin    varchar2(10000);    
a_isin    varchar2(10000);     
v_from_dt date; 
       
    Cursor c1 is                  
    Select ui_user_cd          
    from   user_info           
    where  ui_active = 'N'                    
    and    to_char(ui_last_upd_dt,'dd-mm-yyyy')= to_char(sysdate,'dd-mm-yyyy'); 
BEGIN                                                           SELECT ui_email  
         
    INTO   mail_id             
    FROM   user_info           
    WHERE  ui_user_cd='SFG';           
    For x in c1 loop    
a_mesg:=a_mesg||crlf||x.ui_user_cd;    
end loop;            
    IF a_mesg IS NULL THEN                                                      
       a_mesg := 'No Users Deactivated Now '||to_char(sysdate,'dd-mm-yyyy');    
    END IF;             
    mail_conn := utl_smtp.open_connection(mailhost, 25);    
utl_smtp.helo(mail_conn, mailhost);    
utl_smtp.mail(mail_conn,'vivek.sharma@pidilite.com');    
utl_smtp.rcpt(mail_conn,mail_id);    
    utl_smtp.rcpt(mail_conn,'vivek.sharma@pidilite.com');
mesg:= 'Date: '||TO_CHAR(SYSDATE,'DD MON YYYY HH24:MI:SS' )|| crlf ||           
'From: CLMS Software Team '|| crlf ||           'Subject: Users deactivated on 
'||sysdate|| crlf||           a_mesg;         
    utl_smtp.data(mail_conn,mesg);   
    utl_smtp.quit(mail_conn);   
END; 

When I execute this procedure, I get an error as

BEGIN clms.mail_job_check; END;

*
ERROR at line 1:
ORA-20001: 450 4.7.1 abhi_s@@pidilite.com... Relaying temporarily
denied. Cannot resolve PTR record for 10.16.0.75
ORA-06512: at "SYS.UTL_SMTP", line 83
ORA-06512: at "SYS.UTL_SMTP", line 223
ORA-06512: at "CLMS.MAIL_JOB_CHECK", line 34
ORA-06512: at line 1

Please suggest a workaround.

Thanks in advance. 

Followup:
workaround:  read the error message.

You are getting apparently a 450 error from your SMTP server (the ora-20001 is 
utl_smtp's way to saying "error encountered -- here is more information"


If you just:

[tkyte@tkyte-pc Desktop]$ telnet 172.6.49.8 25
Trying 172.6.49.8...
Connected to xxxx.
Escape character is '^]'.
220 aria.us.oracle.com ESMTP Sendmail 8.10.2+Sun/8.10.2; Mon, 31 Mar 2003 
08:35:55 -0500 (EST)
HELO <hostname -- whatever the hostname of 172.6.49.8 is>
250 aria.us.oracle.com Hello tkyte-pc.us.oracle.com [138.1.120.255], pleased to 
meet you
MAIL FROM: vivek.sharma@pidilite.com
250 2.1.0 vivek.sharma@pidilite.com... Sender ok
RCPT TO: vivek.sharma@pidilite.com
250 2.1.5 vivek.sharma@pidilite.com... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
hello tom
.
250 2.0.0 h2VDb7229862 Message accepted for delivery
QUIT
221 2.0.0 aria.us.oracle.com closing connection
Connection closed by foreign host.
[tkyte@tkyte-pc Desktop]$



and you just enter the stuff in BOLD, you'll reproduce the same exact error. 
 This is a SMTP configuration issue -- you need to talk to your email guys. 

<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script> utl_smtp strangeness 9.2April 14, 2003
Reviewer: Ray from Ottawa,On,ca
declare
mailhost  varchar2(30) := '999.11.2.99' ;
mail_conn utl_smtp.connection;        
mesg      varchar2(4000);
begin
mail_conn := utl_smtp.open_connection(mailhost, 25);    
utl_smtp.helo(mail_conn, mailhost);    

utl_smtp.mail(mail_conn,'a_b@aaa-bbb.xx.yy');
   
utl_smtp.rcpt(mail_conn,'a_b@aaa-bbb.xx.yy');    
mesg:= 'text';         
utl_smtp.data(mail_conn,mesg);   
utl_smtp.quit(mail_conn);   
END; 

ORA-29279: SMTP permanent error: 501 strangeness between : and <
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 98
ORA-06512: at "SYS.UTL_SMTP", line 221
ORA-06512: at line 8

this error occurs at the .mail call

What is it trying to tell me with between : and <

When I telnet this IP it responds initially but that's it

The mail server is notes/domin

any help is appreciated.
 

Followup:
Well, thats not a database error -- that is the SMTP server being finicky.  

RFC 821 states that all envelope information should be enclosed in angle 
brackets. 

try putting <> about your email addresses. 

<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script> smtpApril 17, 2003
Reviewer: Ray from Ottawa,on,ca
yup that did it thanks 

June 28, 2003
Reviewer: j.
hi tom, everything works fine so far.

now I wonder if there is any way to check whether given email addresses were 
valid.

can the database get notified if mail delivery fails? 

Followup:
the email will bounce back and you can use the other parts of the javamail api 
to "read" mail as easily as "send mail"

so, instead of using utl_smtp, you can load up the java mail api and use it to 
do lots more. 

<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script> How can we provide username and password for smtp authJune 15, 2004
Reviewer: Monish from CO, US
Hi Tom,

We are using SMTP Authentication. Is there a way I could provide username and 
password to the smtp server via pl/sql.

SQL> execute send_mail('support@xyz.com','abc@jfk.com','this is a test');
BEGIN send_mail('support@xyz.com','abc@jfk.com','this is a test'); END;

*
ERROR at line 1:
ORA-29279: SMTP permanent error: 530 Authentication Required
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 98
ORA-06512: at "SYS.UTL_SMTP", line 240
ORA-06512: at "SCOTT.SEND_MAIL", line 11
ORA-06512: at line 1

Thanks 

Followup:
you can write directly to the SMTP server and do the authorization, yes.

just telnet to your SMTP server (telnet hostname 25) and type HELP

> telnet aria 25
Trying 138.2.5.51...
Connected to aria.
Escape character is '^]'.
220 aria-lnx.us.oracle.com ESMTP Sendmail 8.11.6/8.11.6; Wed, 16 Jun 2004 
12:02:18 -0400
HELP
214-2.0.0 This is sendmail version 8.11.6
214-2.0.0 Topics:
214-2.0.0       HELO    EHLO    MAIL    RCPT    DATA
214-2.0.0       RSET    NOOP    QUIT    HELP    VRFY
214-2.0.0       EXPN    VERB    ETRN    DSN     AUTH
214-2.0.0       STARTTLS
214-2.0.0 For more info use "HELP <topic>".
214-2.0.0 To report bugs in the implementation send email to
214-2.0.0       sendmail-bugs@sendmail.org.
214-2.0.0 For local information send email to Postmaster at your site.
214 2.0.0 End of HELP info


You'll see a list of commands it supports.  from there, you'll have to figure 
out the protocol your server is using to authenticate (should be able to google 
that up, some rfc somewhere)....

then you can use utl_smtp to write that information to the SMTP server. 

<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script> it is very handy January 19, 2005
Reviewer: Mehmood from Karachi, Pakistan
Dear Tom:

It is very handy to get emails from Oralce server. I have used the same 
procedure which you have given, I do get the emails from Oracle server having 
used the UTL_SMTP, but unfortunately I dont get any message in those emails. 
Your response will be highly appreicated. 

Followup:
it has always worked for me.


ctl-f on this page for telnet.  do it by hand.  take the database out of the 
loop. All we are doing is exactly what you can do in telnet.  

<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script> utl_smtp.dataApril 20, 2005
Reviewer: Ratnamachary from IND
Tom,
I've problem in sending text more than 2000 charectors using utl.smtp.data 
function.
Is there any limitation for this?
I'm getting Numeric or Value error.
The text which I want to send I'm building in PL/SQL procedure and passing as 
input parameter for sendmail procedure.
I'm using Oracle version 8.1.7.

Please advise.

Thanks
-Chary 

Followup:
give example. 

<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script> Error 530 - Authentication requiredSeptember 20, 2005
Reviewer: Manju P from IND
Hi,

I am trying to send a mail to myself. I am getting the same error. tried almost 
everything mentioned here. 
ERROR at line 1:
ORA-20002: 530 Authentication required ORA-06512: at "SYS.UTL_SMTP", line 86 
ORA-06512: at "SYS.UTL_SMTP", line 204 
ORA-06512: at "CM_UAT.SEND_MAIL", line 10 ORA-06512: at line 2

sometimes i am getting error 421 - Service not available error. 

latest is plsql statement executed successfully. BUT I STILL HAVEN'T RECEIVED 
THE MAIL 

Followup:
that is saying you need to supply a username and password to use your SMTP 
server - you need to either

ask you admins for an smtp server that doesn't need that (likely you don't have 
one if they use one with authentication)

or

read a bit about the smtp protocol and see how to send the required 
authentication tokens. 
分享到:
评论

相关推荐

    关于游标问题的解答

    kris -- Thanks for the question regarding "Cursor in SQL", version 10.2.0

    delphixe10 RxLib_For_RX10插件

    Unofficial version Rx library for Delphi 2005/2006/2007/2009/2010/XE/XE2/XE3 DISCLAIMER: * This software is provided "as is" and is without warranty of any kind. The author(s) of this software does...

    RxLib_2.75_Update_1.0.17_for_D5-XE10.1_Berlin

    Unofficial version Rx library for Delphi 2005/2006/2007/2009/2010/XE/XE2/XE3/XE4/XE5/XE6/XE7/XE8/Seattle/Berlin DISCLAIMER: * This software is provided "as is" and is without warranty of any kind. ...

    RX Lib_For D5~XE2 XE3

    representations regarding the use or results of use of this software in terms of reliability, accuracy or fitness for purpose. You assume the entire risk of direct or indirect, consequential or ...

    unrxlib_275_u_1_0_13

    representations regarding the use or results of use of this software in terms of reliability, accuracy or fitness for purpose. You assume the entire risk of direct or indirect, consequential or ...

    RxLib_2.75_Update_1.0.18_for_D5-XE10.2Tokyo

    Unofficial version Rx library for Delphi 2005/2006/2007/2009/2010/XE/XE2/XE3/XE4/XE5/XE6/XE7/XE8/Seattle/Berlin DISCLAIMER: * This software is provided "as is" and is without warranty of any kind. ...

    8-On-the-Wiener-and-Hammerstein-Models-for-Power-_Hammerstein_Mo

    account the operational complexity regarding the identification process as well as their accuracy to follow the PA behavior. Both identified PA models will be used to estimate a Hammerstein based ...

    ixed.7.4_ixed.7.4.lin下载_ixed.7.4_TheNumber_

    ixed.7.4 sourceguardianA PHP Error was encounteredSeverity: User ErrorMessage: SourceGuardian Loader - This protected script was not encoded for version 5.4.31 of PHP. Please re-encode or contact the ...

    The Matlab scripts for five positioning algorithms regarding

    The Matlab scripts for five positioning algorithms regarding UWB localization.zip

    SSD7 选择题。Multiple-Choice

    (b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have...

    Senfore_DragDrop_v4.1

    Please choose the most appropiate newsgroup for your question. Do not cross post to them all. Before posting to the newsgroups, I suggest you try to search for an answer on the Google (DejaNews) ...

    The Definitive Guide to Jython-Python for the Java Platform

    The book provides a general overview of the Jython language itself, but it also includes intermediate and advanced topics regarding database, web, and GUI applications; Web services/SOA; and ...

    C Programming - Just the FAQS

    regarding the conventions, keywords, and terms used with the C language. This chapter attempts to answer some of the most frequently asked questions regarding these subjects. For instance, one of the ...

    My Botnet is Bigger than Yours (Maybe, Better than Yours) :why size estimates remain challenging

    Among researchers, in the press, and in the classroom—the questions regarding the widespread effect of botnets seem never-ending: what are they? how many are there? what are they used for? Yet, time...

    510(k)-for-a-Change-to-an-Existing-Device.pdf

    For questions about this document regarding CDRH-regulated devices, contact the 510(k) Staff at 301-796-5640. For questions about this document regarding CBER-regulated devices, contact the Office ...

    8-07-14_MegaCLI for linux_windows

    LSIP200232921 (DFCT) MegaCLI displays version for PD in unclear format and the data is not aligned correctly LSIP200232954 (DFCT) Need to Support all the MFC default values in the command AdpSettings...

    surfer8中文破解版

    Surfer Home Page - For the latest information about Surfer. Frequently Asked Questions - For answers to the most popular questions related to Surfer. Help is also available through the Surfer ...

    Dundas.Chart.for.Winform.Enterprise.v7.1.0.1812.for.VS2008

    Horizontal Error Bars - Version 6.0 gives developers the ability to add error bars to bar charts, which offers additional statistical information regarding the data on the chart for more in depth ...

    OCP考试WORD文档(一小部分)

    OCP考试WORD文档(一小部分) OCP EXAM Number: 1Z0-051 Passing Score: 800 Time Limit: 60 min File Version: 9.02 ...QUESTION 1 ...View the Exhibit and ...Which statement is true regarding the above command?

    A computational model for developing semantic web-based educational systems

    Recently, some initiatives to start the so-called semantic web-based educational systems (SWBES) have emerged in the field of artificial ...regarding the computational model construction is available

Global site tag (gtag.js) - Google Analytics