Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email. (文档 ID 604763.1) 转到底部

In this Document

  Symptoms
  Cause
  Solution
  References

APPLIES TO:

PL/SQL - Version 9.2.0.8 and later
Information in this document applies to any platform.
***Checked for relevance on 13-May-2014***

SYMPTOMS

When trying to send email using UTL_SMTP getting following error :

ORA-29278: SMTP transient error: 421 Service not available 
ORA-06512: at "SYS.UTL_SMTP", line 21 
ORA-06512: at "SYS.UTL_SMTP", line 97 
ORA-06512: at "SYS.UTL_SMTP", line 139

Or potentially

ORA-29279: SMTP permanent error

followed by a SMTP error code.

CAUSE

The "ORA-29278: SMTP transient error: 421 Service not available" error indicates that the problem is not with the UTL_SMTP package 
but the fact that your database server's network configuration does not allow it to contact an external server.

SOLUTION

You first have to check whether you are able to contact the email server without involving ORACLE.

For example use the following telnet procedure to see whether the mail server is reachable from the Database server:

******PERFORM THE FOLLOWING OPERATIONS FROM YOUR DATABASE SERVER MACHINE AND NOT FROM OTHER MACHINES.****** 

Note: The information presented here does not apply to TLS/SSL connections .

a) Start a telnet session to the SMTP server's communication port. (The default port for SMTP is 25)

$telnet <smtp servername as used utl_smtp package> 25

A telnet session should open with a response from smtp:

For eg :

response from smtp ---> 220 ukxxx1 Sendmail SMI-8.6/SMI-SVR4 ready at 
Thu, 16 Sep 1999 15:14:25 +0100

b) Now introduce the client machine to the server by typing: 
helo domain
(The correct spelling is helo - not hello)

c) Tell the SMTP Gateway who the test email is coming from by typing: 
-------> mail from: emailid@domain

For eg :

A response from smtp ---> 250 emailid@domain... Sender ok

d) Tell the SMTP Gateway who to send the test email to by typing: 
--------> rcpt to: emailid@domain

For eg :

A response from smtp ---> 250 emailid@domain... Recipient ok

e) Tell the SMTP Gateway what type of information is being sent by typing: 
-------> data

A response from smtp ---> 354 Enter mail, end with "." on a line by itself

f) Enter the test message and remember to close the email with a dot "." 
Type ---> Subject: SMTP Test 
Hello this is an smtp test for EM. .

A response from smtp ---> 250 PAA15913 Message accepted for delivery

g) End the SMTP connection session by typing: 
--------> quit

response from smtp ---> 221 ukxxx1 closing connection 
The connection has been terminated.

The email should then be delivered to the receiver via the SMTP server.

If the command line test doesn't work, hopefully a helpful error messages from the SMTP server will be displayed indicating a problem will be with the SMTP server setup.

If the above telnet session fails it confirms the network block . You may have to contact your network administrator to remove the block. 
Once your network administrator removes the block , retry the above telnet session. 
Before using UTL_SMTP , please ensure that the telnet session succeeds.

If the telnet session succeeds, then try the following sample code to test the smtp server :

Note : Please change the smtp server name in line number 6 and 7 in procedure TESTMAIL.

Note: If the below code fails again with the same error , then use IP Address instead of Mail server name in line number 6 and 7.
 OR
Make the hostname entry in the /etc/hosts file so that it is properly resolved to an IP address
CREATE OR REPLACE PROCEDURE TESTMAIL(fromm VARCHAR2,too VARCHAR2,sub VARCHAR2,body VARCHAR2,port NUMBER) 
IS 
objConnection UTL_SMTP.CONNECTION; 
vrData VARCHAR2(32000); 
BEGIN 
objConnection := UTL_SMTP.OPEN_CONNECTION('<user smtp server name or ip address>',PORT); 
UTL_SMTP.HELO(objConnection, '<user smtp server name or ip address>'); 
UTL_SMTP.MAIL(objConnection, fromm); 
UTL_SMTP.RCPT(objConnection, too); 
UTL_SMTP.OPEN_DATA(objConnection);

UTL_SMTP.WRITE_DATA(objConnection, 'From: '||fromm || UTL_TCP.CRLF); 
UTL_SMTP.WRITE_DATA(objConnection, 'To: '||too || UTL_TCP.CRLF);

UTL_SMTP.WRITE_DATA(objConnection, 'Subject: ' || sub || UTL_tcp.CRLF); 
UTL_SMTP.WRITE_DATA(objConnection, 'MIME-Version: ' || '1.0' || UTL_tcp.CRLF); 
UTL_SMTP.WRITE_DATA(objConnection, 'Content-Type: ' || 'text/html;');

UTL_SMTP.WRITE_DATA(objConnection, 'Content-Transfer-Encoding: ' || '"8Bit"' || UTL_TCP.CRLF); 
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF); 
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<HTML>'); 
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<BODY>'); 
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<FONT COLOR="red" FACE="Courier New">'||body||'</FONT>'); 
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'</BODY>'); 
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'</HTML>'); 
UTL_SMTP.CLOSE_DATA(objConnection); 
UTL_SMTP.QUIT(objConnection); 
EXCEPTION 
WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN 
UTL_SMTP.QUIT(objConnection); 
DBMS_OUTPUT.PUT_LINE(SQLERRM); 
WHEN OTHERS THEN 
UTL_SMTP.QUIT(objconnection); 
DBMS_OUTPUT.PUT_LINE(SQLERRM); 
END TESTMAIL; 
/

DECLARE 
Vdate Varchar2(25); 
BEGIN 
Vdate := to_char(sysdate,'dd-mon-yyyy HH:MI:SS AM'); 
TESTMAIL('xxx.xxx@xxx.com', 'xxx.xxx@xxx.com', 'TESTMAIL','This is a UTL_SMTP-generated email at '|| Vdate,25); 
END; 
/

Collaborate with and learn from your Peers, Industry Experts and Oracle Support Product Specialists using My Oracle Support Community. Join us here:

Oracle Community - https://communities.oracle.com/

Oracle PL/SQL Community - https://community.oracle.com/community/support/oracle_database/pl_sql

REFERENCES

NOTE:74269.1 - How to Test an SMTP Mail Gateway From a Command Line Interface
NOTE:1559609.1 - ORA-29278: SMTP Transient Error: 452 4.4.5 Insufficient Disk Space

Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email的更多相关文章

  1. SSRS1:配置SMTP Server发送mail

    为了使用SSRS发送mail,必须为Reporting service配置SMTP Server. 1,在Reporting Service Configuration Manager中配置Email ...

  2. Spring – Sending E-Mail Via Gmail SMTP Server With MailSender--reference

    Spring comes with a useful ‘org.springframework.mail.javamail.JavaMailSenderImpl‘ class to simplify ...

  3. 安装VisualSVN Server 报"Service 'VisualSVN Server' failed to start. Please check VisualSVN Server log in Event Viewer for more details"错误.原因是启动"VisualSVN Server"失败

    安装VisualSVN Server 报"Service 'VisualSVN Server' failed to start. Please check VisualSVN Server ...

  4. 关于安装SVN Service 出错 Service 'VisualSVN Server' failed to start. Please check VisualSVN Server log in Event Viewer for more details

    关于安装SVN Service 出错 Service 'VisualSVN Server' failed to start. Please check VisualSVN Server log in ...

  5. kibana加访问控制时报错--Kibana did not load properly.Check the server output for more information.

    错误 在使用kibana的时候,我们需要对可以进行日志访问进行控制,x-pack插件是最好的选择,但是kibana的x-pack插件是收费的,我们本着节约资源的理念(公司的钱也是钱啊,哈哈),我决定使 ...

  6. oracle中的listener.ora和tnsnames.ora

    一.oracle的客户端与服务器端 oracle在安装完成后服务器和客户端都需要进行网络配置才能实现网络连接.    服务器端配置监听器,客户端配置网络服务名. 服务器端可配置一个或多个监听程序 . ...

  7. 记录一份Oracle 正确的监听配置文件listener.ora与tnsnames.ora

    一.前言 昨天中午接到领导指示,有其他组的负责人B在厄瓜多尔演示他们组的产品,然后我们组的负责人就想说也在那边搭一套环境,(北美那边的亚马逊云环境),让B帮忙演示下我们的系统. 于是,开始了一个比较曲 ...

  8. PLSQL连接ORACLE配置字符串简介 oracle网络配置 三个配置文件 listener.ora、sqlnet.ora、tnsnames.ora原理解释

    PLSQL连接ORACLE配置字符串简介 oracle网络配置 三个配置文件 listener.ora.sqlnet.ora.tnsnames.ora原理解释 oracle网络配置三个配置文件 lis ...

  9. oracle: listener.ora 、sqlnet.ora 、tnsnames.ora的配置及例子

    1.解决问题:TNS或者数据库不能登录.      最简单有效方法:使用oracle系统提供的工具 netca 配置(把原来的删除掉重新配置)     $netca  2.然而,仍有疑问:如何指定'l ...

随机推荐

  1. C++数据结构之最小生成树

    最小生成树是图的一部分,一般求最小生成树用Prim算法和Kruskal算法. 对于Prim算法,思想是:在访问过的顶点和未访问的顶点之间选择权值最小的边.Prim算法是基于顶点的操作,适合于顶点较少, ...

  2. Make 命令教程 -- 阮一峰

    摘自http://www.ruanyifeng.com/blog/2015/02/make.html Make 命令教程 作者: 阮一峰 日期: 2015年2月20日 代码变成可执行文件,叫做编译(c ...

  3. mongodb启动关闭;

    [正确关闭方法] 方法一 ps  -ef |grep mongodb 找到你要查找的进程号 kill -2  pid    杀掉 方法二 也可以进入到mongo数据库里面进行操作./mongouse ...

  4. MVC折线图应用

    后台 获取值并转换成json数据存到实体里面,然后前台输出 HighchartsModels model = new HighchartsModels(); model.DataDicJson = J ...

  5. css中关于transform、transition、animate的区别

    写动画经常会用到这几个属性,他们之间有什么区别呢? 1.transform 每每演示transform属性的,看起来好像都是带动画.这使得小部分直觉化思维的人(包括我)认为transform属性是动画 ...

  6. C# 获取本机IP地址以及转换字符串

    /// <summary> /// IP地址转化 /// </summary> /// <param name="ipaddr">整型的IP地址 ...

  7. erp crm oa

    erp是企业管理计划 crm是客户关系管理 oa是办公自动化erp管理的是企业的进销存.产供销.财务等crm主要是管理企业的客户,可以和erp的销售系统挂钩oa主要是管理一些内部的文档.公告,行政信息 ...

  8. Vijos 1121 马拦过河卒

    首先要看清题目,卒只能向右或者向下走.而不是四周转.这样的话就无解了. 定义f[i][j],表示走到(i,j)这个点时的总步数.这样就写出了一个递推公式f[i][j]=f[i-1]+f[i][j-1] ...

  9. mysql 更新 语句中 的 safe_mode

    在mysql5中,可以设置safe mode,比如在一个更新语句中UPDATE table_name SET bDeleted=0;执行时会错误,报:You are using safe update ...

  10. Android_实现静默安装和卸载应用

    转:http://www.cnblogs.com/ondream/archive/2012/04/13/2446138.html 前段时间做了一个批量安装卸载应用程序的小应用,由于安装卸载应用程序的部 ...