SQL 如何解决发送邮件:ORA-29279 SMTP 问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34721549/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve send mail: ORA-29279 SMTP issue
提问by Hafiz Usman aftab
I'm getting an ORA-29279 error when running the below snipped. Suggest me if some issue in this
运行以下代码时出现 ORA-29279 错误。如果这有问题,请建议我
CREATE OR REPLACE PROCEDURE CPO.fsc_temp_MAIL (l_from IN VARCHAR2,
l_to IN VARCHAR2,
Subject IN VARCHAR2,
Mesg IN VARCHAR2,
Cc IN VARCHAR2 default null,
P_Html BOOLEAN := FALSE) IS
l_to1 VARCHAR2(32000) := l_to;
Mhost VARCHAR2(64) := '192.168.0.6';
crlf varchar2(2) := CHR(13) || CHR(10);
conn UTL_SMTP.connection;
Address varchar2(32700);
BEGIN
conn := UTL_SMTP.open_connection(Mhost,25);
UTL_SMTP.helo(conn, Mhost);
UTL_SMTP.mail(conn, l_from);
GET_TEMP_INFO_MAIL(conn,l_to1);
If Cc is not null then
GET_TEMP_INFO_MAIL(conn,Cc);
end if;
IF P_Html THEN
Address := 'Date: ' || TO_CHAR(SYSDATE, 'DD MON RRRR HH24:MI:SS') ||
crlf ||'From: ' || l_from ||
crlf ||'To: ' || l_to ||
crlf ||'Cc: ' || Cc ||
crlf ||'Subject: ' || Subject || crlf
|| 'Content-Type: text/html; charset=us-ascii' || crlf
|| 'Content-Transfer-Encoding: 7bit' || crlf
|| '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' || crlf
|| '<html>' || crlf
|| '<head>' || crlf
|| '<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">' || crlf
|| '<title>' || subject || '</title>' || crlf
|| '</head>' || crlf
|| '<body>' || crlf|| utl_tcp.crlf
|| mesg || crlf
|| '</body></html>';
ELSE
Address := 'Date: ' || TO_CHAR(SYSDATE, 'DD MON RRRR HH24:MI:SS') ||
crlf ||'From: ' || l_from ||
crlf ||'To: ' || l_to ||
crlf ||'Cc: ' || Cc ||
crlf ||'Subject: ' || Subject ||
crlf || utl_tcp.crlf || mesg;
END IF;
UTL_SMTP.data(conn, Address);
UTL_SMTP.quit(conn);
EXCEPTION
WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
END;
when I execute that procedure
当我执行那个程序时
execute fsc_temp_MAIL('[email protected]','[email protected]','test for subject ','sdf','[email protected]',True);
ORA-29279: SMTP permanent error: 530 5.7.1 Client was not authenticated
ORA-29279: SMTP 永久错误: 530 5.7.1 客户端未通过身份验证
don't know how to deal with this this is some kind of smtp setting ? all email address is valid
不知道如何处理这是某种 smtp 设置?所有电子邮件地址均有效
if some one have better solution then tell me I create these pocedure in plsql
如果有人有更好的解决方案,那么告诉我我在 plsql 中创建了这些程序
回答by Sentinel
The result code from the SMTP server: 530 5.7.1 Client was not authenticated is telling you that you need to authenticate with the server. Specifically result code 530 indicates that you "must issue a STARTTLS command. Encryption required for requested authentication mechanism"
来自 SMTP 服务器的结果代码:530 5.7.1 客户端未通过身份验证告诉您需要向服务器进行身份验证。具体结果代码 530 表示您“必须发出 STARTTLS 命令。请求的身份验证机制需要加密”
The STARTTLS
command further requires you to use an extended form of the call to OPEN_CONNECTION
passing in details of the Oracle wallet to use when securing the connection. You may also need to make a call the AUTH
function or procedure to fully authenticate your connection.
该STARTTLS
命令还要求您使用扩展形式的调用来OPEN_CONNECTION
传递保护连接时要使用的 Oracle 钱夹的详细信息。您可能还需要调用AUTH
函数或过程来完全验证您的连接。
Please view the UTL_SMTPdocumentation for additional info.
请查看UTL_SMTP文档以获取更多信息。
回答by Sahil Pareek
Check your host. This is the host problem. Use the query.
检查您的主机。这是主机问题。使用查询。
SELECT UTL_INADDR.get_host_name,UTL_INADDR.get_host_address('your-server-address') FROM dual;
SELECT UTL_INADDR.get_host_name,UTL_INADDR.get_host_address('your-server-address') FROM dual;