错误在调用发送邮件程序后Happend

问题描述 投票:0回答:1

我在sql developer oracle中创建了一个名为send_mail的过程,如下所示。

create or replace procedure Send_Mail(Msg_To varchar2, Msg_Subject varchar2, Msg_Text varchar2) is

    c        Utl_Smtp.Connection;
    Rc       integer;
    Msg_From varchar2(50) := '[email protected]'; -- email of my company which hosted on Gmail
    Mailhost varchar2(30) := 'smtp.gmail.com';


begin
    c := Utl_Smtp.Open_Connection(Mailhost, 587);
    Utl_Smtp.Ehlo(c, Mailhost);
    Utl_Smtp.StartTLS(c);
    Utl_Smtp.Ehlo(c, Mailhost);
    Utl_Smtp.Mail(c, Msg_From);
    Utl_Smtp.Rcpt(c, Msg_To);

    Utl_Smtp.Data(c,
                  'From: Oracle Database' || Utl_Tcp.Crlf || 'To: ' || Msg_To || Utl_Tcp.Crlf || 'Subject: ' || Msg_Subject || Utl_Tcp.Crlf ||
                  Msg_Text);
    Utl_Smtp.Quit(c);

exception
    when Utl_Smtp.Invalid_Operation then
        Dbms_Output.Put_Line(' Invalid Operation in Mail attempt 
using UTL_SMTP.');
    when Utl_Smtp.Transient_Error then
        Dbms_Output.Put_Line(' Temporary e-mail issue - try again');
    when Utl_Smtp.Permanent_Error then
        Dbms_Output.Put_Line(' Permanent Error Encountered.');
end;

当我试图调用程序发送电子邮件时,它会给出错误,请帮助我,我想发送电子邮件。我知道我的错误在哪里。我已经授予所有命令

GRANT EXECUTE ON UTL_TCP  TO admonline;
GRANT EXECUTE ON UTL_SMTP TO admonline;
GRANT EXECUTE ON UTL_MAIL TO admonline;
GRANT EXECUTE ON UTL_http TO admonline;
--Calling procedure
BEGIN
send_mail(msg_to      => '[email protected]',
          msg_subject => 'Test subject',
          msg_text    => 'Test text');
END;   

提到错误

 Certificate validation failure
    ORA-06512: at "SYS.UTL_TCP", line 59
    ORA-06512: at "SYS.UTL_TCP", line 284
    ORA-06512: at "SYS.UTL_SMTP", line 284
    ORA-06512: at "SYS.UTL_SMTP", line 289
    ORA-06512: at "ADMONLINE.SEND_MAIL", line 11
    ORA-06512: at line 2
    29024. 00000 -  "Certificate validation failure"

    *Cause:    The certificate sent by the other side could not be validated. This may occur if
               the certificate has expired, has been revoked, or is invalid for another reason.

    *Action:   Check the certificate to determine whether it is valid. Obtain a new certificate,
               alert the sender that the certificate has failed, or resend.
oracle oracle11g oracle-sqldeveloper oracle-apex oracle-apex-5
1个回答
0
投票

错误似乎很清楚。尝试googliing UTL_SMTP,证书和29024. 00000 - “证书验证失败”也阅读有关如何使用此包的文档。这似乎是安全证书的失败。

一个快速的谷歌出现了this

此外,作为一个菜鸟,记住你要求我们抽出时间来帮助你。通过始终包含产品版本以及您尝试过的步骤以及结果以及您尝试过的搜索和调查来帮助我们。

这些可能有所帮助:https://mathijsbruggink.com/2013/10/24/sending-mail-from-an-11g-oracle-database-utl_smtp/ https://community.oracle.com/thread/930797 http://www.dadbm.com/enable-oracle-database-to-send-emails-via-smtp-server/ https://community.oracle.com/thread/368259

https://community.oracle.com/thread/4089002 https://oracle-base.com/articles/misc/utl_http-and-ssl

https://docs.oracle.com/database/121/ARPLS/u_smtp.htm#ARPLS074 https://oracle-base.com/articles/misc/email-from-oracle-plsql

© www.soinside.com 2019 - 2024. All rights reserved.