Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email

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

修改时间:2014-5-13类型:PROBLEM
为此文档评级 通过电子邮件发送此文档的链接 在新窗口中打开文档


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: [email protected]

For eg :

A response from smtp ---> 250 [email protected] Sender ok

d) Tell the SMTP Gateway who to send the test email to by typing: 
--------> rcpt to: [email protected]

For eg :

A response from smtp ---> 250 [email protected] 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(‘[email protected]‘, ‘[email protected]‘, ‘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,布布扣,bubuko.com

时间: 2024-10-13 23:11:05

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

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

Spring comes with a useful ‘org.springframework.mail.javamail.JavaMailSenderImpl‘ class to simplify the e-mail sending process via JavaMail API. Here’s a Maven build project to use Spring’s ‘JavaMailSenderImpl‘ to send an email via Gmail SMTP server.

The Tomcat server configuration at \Servers\Tomcat v7.0 Server at localhost-config is missing. Check the server for errors.

tomcat突然报错,The Tomcat server configuration at \Servers\Tomcat v7.0 Server at localhost-config is missing. Check the server for errors. 具体报错原因不太清楚,不过肯定是因为一些关联的信息缺失导致 解决办法: 删掉原先关联的tomcat,重新关联一个新的 prefencen-->service-->runtime environments,删除原先所有的tomca

安装VisualSVN Server 报&quot;Service &#39;VisualSVN Server&#39; failed to start. Please check VisualSVN Server log in Event Viewer for more details&quot;错误.原因是启动&quot;VisualSVN Server&quot;失败

安装VisualSVN Server 报"Service 'VisualSVN Server' failed to start. Please check VisualSVN Server log in Event Viewer for more details"错误.原因是启动"VisualSVN Server"失败 安装 VisualSVN Server 服务启动失败 咱们先来看一下这个服务在哪,计算机-右键-管理或者系统服务-在服务里面可以看到一个"

listener.ora 、sqlnet.ora 、tnsnames.ora的关系以及手工配置

listener.ora.sqlnet.ora.tnsnames.ora ,都是放在$ORACLE_HOME\network\admin目录下. --begin 重点:三个文件的作用和使用 #----------------------- sqlnet.ora(客户及服务器端) --作用类似于linux或者其他unix的nsswitch.conf文件,通过这个文件来决定怎么样找一个连接中出现的连接字符串, 例如我们客户端输入 sqlplus sys/[email protected] 假如我的s

Oracel数据库 listener.ora和tnsnames.ora配置

oracel服务经常会出现各种监听问题,很多情况是 listener.ora和tnsnames.ora 的配置有问题  D:\app\Administrator\product\11.2.0\dbhome_1 oracel安装路径径参考自己的 listener.ora配置 # listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.or

真心崩溃了,oracle安装完成后居然没有tnsnames.ora和listener.ora文件

problem: oracle  11  r2  64位安装完成后NETWORK/ADMIN目录下居然没有tnsnames.ora和listener.ora文件 solution: 问题是之前安装了另外一个版本的oracle,我是安装了oracle xe,没有卸载干净,导致在环境变量中存在TNS_ADMIN指向了不正确的目录.如下图所示: 上图中的TNS_ADMIN的配置是正确的,原来的配置是错误的.原来的配置指向的是d:\oraclexe下的某个目录,因为指向的目录已经被删除,所以用oracl

Oracle的listener.ora、tnsnames.ora的配置

使用DBCA建库,Global Database Name为:prod.origtec.com      SID:prod An Oracle database is uniquely identified by a Global Database Name,typically of the form "name.domain" Global Database Name: A database is referenced by at least one Oracle instance

安装好oracle11gR2之后在相应路径下却没有生成tnsnames.ora和listener.ora

oracle安装帖子:https://blog.csdn.net/wjb123sw99/article/details/80780277 oracle安装过程中检查失败:需开启C盘共享,或者勾选忽略,参考帖子http://blog.itpub.net/22969361/viewspace-1188283/ Oracle安装失败后,彻底卸载Oracle帖子:https://blog.csdn.net/Devin_LiuYM/article/details/59539020 安装完oracle,C:

解决“The Tomcat server configuration at \Servers\Tomcat v8.0 Server at localhost-config is missing. Check the server for errors.”

remove已经创建的server