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('[email protected]', '[email protected]', '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
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 | ||||||||||||||||||||
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
<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script>
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).
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,'[email protected]'); utl_smtp.rcpt(mail_conn,mail_id); utl_smtp.rcpt(mail_conn,'[email protected]'); 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.
<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script>
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,'[email protected]'); utl_smtp.rcpt(mail_conn,'[email protected]'); 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. <script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script>
Reviewer: Ray from Ottawa,on,ca yup that did it thanks
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? <script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script>
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('[email protected]','[email protected]','this is a test'); BEGIN send_mail('[email protected]','[email protected]','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
<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script>
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.
<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script>
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
<script language="JavaScript1.1" type="text/javascript"> document.getElementById("latestLink").style.display = "inline" </script>
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 |